BLOGS

COMMENT

warning: file_get_contents(http://www.telize.com/geoip/54.146.50.80) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/www.4d.com/docs/includes/common.inc(1762) : eval()'d code on line 4.

Find what you're looking for

A powerful, application-wide search and replace tool lets you find any item in the development environment. Your search can be as broad (any object, text, “contains” a string, etc.) or as restrictive (search for a specific constant using the full name) as you want, with results easy to view, organize and manipulate.

 

4D v12's find dialog is remarkably intuitive and easy to use. Use its menus to create a natural search sentence, like "Find variables whose name contains airport."

Additional search options

4D v12 provides additional options to help you fine-tune your searches. 

 

  • Use "Language expression" to find places where a variable is initialized (using the assignation ":=" operator) and where it is tested (using the comparison "=" operator)
  • Find a command, a form, a table, or any object containing specific text. For example, "Find text which contains airport" will find all forms, methods, tables, menu, etc. whose name contains "airport", or which contain an object whose name contains "airport" (a method using the "Airport" table, for example).
  • Define the search mode by using 4 comparison operators: "contains", "is exactly", "starts with" or "ends with". You can use the wildcard, "@", to extend the search.
  • Add the "modification date of the parent". For example "Find variables whose name is exactly L_airportID where the modification date of the parent is this week." This will find all forms and methods that use the L_airportID variable and were modified during the last 7 days.
  • Specify a folder in order to limit the scope of the search.

 

Results display

  • For better readability, results are grouped by types of object, then alphabetically.

 

  • A toolbar at the bottom of the window lets you control the list. For example, you can collapse-expand the list for a cleaner view of your search results.

 

Replace in content

The toolbar also offers a feature called "Replace in content" that allows you to rename or replace any expression throughout your application. The replacement will be performed on every object that appears in the list.

 

Let's use, for example, the name of a form:

  • When you change a form’s name, use "Replace in content" to change the name everywhere it's used
  • If you duplicate the form and need to change the name only in a particular section of the list (typically, the methods that will specifically use this form), select the items that must be excluded, choose "Remove from list", and then “Replace in content”.

 

Beyond the dialog

The Global Find and Replace feature isn't only limited to this main dialog. 4D v12 adds two search features that make refactoring your code easier than ever.

 

Rename

In the Edit menu, two items allow you to search for:

  • Unused methods and global variables
  • Unused local variables

 

This powerful feature is very useful during the eventual "code cleaning" sessions that happen as your application grows and changes. Of course, the usual warning applies: If a method or variable is used only with its hard-coded name (the name is typically passed as a parameter to a method, or Get pointer ( ) is used), the search will see it as used.

 

Within the Method Editor, simply right-clicking on a method or variable allows you to rename it, throughout the whole database when applicable (not for local variables), or only in the method itself.

 

Watch this video to see these features in action!