Search is everything, and the size of AX 2012 applications calls for a powerful and effective search tool.
You can start the Find tool, shown in Figure 2-23, from any node in the AOT by pressing Ctrl+F or by clicking Find on the context menu. The Find tool supports multiple selections in the AOT.
FIGURE 2-23 The Find tool.
On the Name & Location tab, you define what you’re searching for and where to look:
- In the Search list, the options are Methods and All Nodes. If you choose All Nodes, the Properties tab appears.
- The Named box limits the search to nodes with the name you specify.
- The Containing Text box specifies the text to look for in the method, expressed as a regular expression.
- If you select the Show Source Code check box, results include a snippet of source code containing the match, making it easier to browse the results.
By default, the Find tool searches the node (and its subnodes) selected in the AOT. If you change focus in the AOT while the Find tool is open, the Look In value is updated. This is quite useful if you want to search several nodes by using the same criterion. You can disable this behavior by clearing the Use Selection check box.
On the Date tab, you specify additional ranges for your search, such as Modified Date and Modified By.
On the Advanced tab, you can specify more advanced settings for your search, such as the layer to search, the size range of elements, the type of element, and the tier on which the element is set to run.
On the Filter tab, shown in Figure 2-24, you can write a more complex query by using X++ and type libraries. The code in the Source text box is the body of a method with the following profile:
boolean FilterMethod(str _treeNodeName, str _treeNodeSource, XRefPath _path, ClassRunMode _runMode)
FIGURE 2-24 Filtering in the Find tool.
The example in Figure 2-24 uses the class SysScannerClass to find any occurrence of the ttsAbort X++ keyword. The scanner is primarily used to pass tokens into the parser during compilation. Here, however, it detects the use of a particular keyword. This tool is more accurate (though slower) than using a regular expression because X++ comments don’t produce tokens.
The Properties tab appears when All Nodes is selected in the Search list. You can specify a search range for any property. Leaving the range blank for a property is a powerful setting when you want to inspect properties: it matches all nodes, and the property value is added as a column in the results, as shown in Figure 2-25. The search begins when you click Find Now. The results appear at the bottom of the dialog box as they are found.
FIGURE 2-25 Search results in the Find tool.
Double-clicking any line in the result set opens the X++ code editor and sets the focus on the code example that matches. When you right-click the lines in the result set, a context menu containing the Add-Ins menu opens.