Tech Tip: Understanding Rename, Prefix, and Replace in method
PRODUCT: 4D | VERSION: 11 | PLATFORM: Mac & Win
Published On: April 22, 2010
4D v11 SQL features many enhancements to the "Find in database" feature. One particular enhancement is that the results dialog provides the ability to:
- Rename
- Prefix
- Replace in method
However each of the above options is not available in all cases.
The Rename option only applies to "Objects", as opposed to 4D code. Said another way, you cannot use the Rename option to rename all occurrances of a variable in your code. According to the 4D v11 SQL Design Reference, the Rename option can be used on the following targets:
- Forms
- Methods
- Variables
Perhaps the trickiest target for renaming is "Variables". In fact this is probably too generic a term. What is really meant is, if an object has a "Variable Name" Property, then you can use the Rename option.
The rules for Prefix are the same as for Rename.
Replace in method, on the other hand, deals only with 4D code. This option can be used to perform a "global" find and replace in any number of methods.
Note that in all cases you need to have the correct kind of target selected. For example if you want to use the Replace in method option, you must have only methods selected in the results list.
To make this easier, the "gear" button in the results dialog provides a "Select" option:
If you need to select all Project Methods, for example, just choose Select -> Project Methods. Then you can use Replace in method as needed.