Tech Tip: Preventing False Positives from Unused Methods Search
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: December 19, 2025
The "Find Unused Methods and Global Variables" feature of designer mode can be useful to help clean up long existing databases. Overtime, methods may be rewriten and replaced and there may be unused methods left behind. Using the "Find Unused Methods and Global Variables" feature from the Design Mode Edit menu can help locate these methods.
The feature looks for methods that are not called anywhere as tokenized calls. Unfortunately, this can cause methods to appear on the results if the method is called as a string from commands such as New process. To avoid this issue a trick is to call the tokenized method in the code in a False condition so that it is actually never executed but is still tokenized.
For example with if method, nightlyProc will only be called in another method as follows:
Because nightlyProc is not tokenized, the it will show up in the list of Unused Methods.
The following can address this issue:
Since nightlyProc is tokenized, it will no longer show up in the list of unused methods, and now searching for references to it will now show this calling method.
The feature looks for methods that are not called anywhere as tokenized calls. Unfortunately, this can cause methods to appear on the results if the method is called as a string from commands such as New process. To avoid this issue a trick is to call the tokenized method in the code in a False condition so that it is actually never executed but is still tokenized.
For example with if method, nightlyProc will only be called in another method as follows:
| var $pid : Integer $pid:=New process("nightlyProc"; 0) |
Because nightlyProc is not tokenized, the it will show up in the list of Unused Methods.
The following can address this issue:
| var $pid : Integer If(False) nightlyProc End if $pid:=New process("nightlyProc"; 0) |
Since nightlyProc is tokenized, it will no longer show up in the list of unused methods, and now searching for references to it will now show this calling method.