Wednesday, 20 June 2012

AOT Exact Match Find in Dynamics AX 2009


Problem - Every time you search for "Address" using the find function in Dynamics AX 2009, you see every word containing the word "Address" in your search results. How do you search for an exact match?
Okay, it took me a while, but I have figured this out, it Is possible.
Adding a breakpoint to the find form shows that it uses a class called SysUtilScanSource to find your string within the AX source code.
In SysUtilScanSource.do() the method match is used to find a match against the specific source code. You can read more about match here;
The match method allows you to use expressions.
The expression you require is as follows;
:SPACE
Where SPACE is the character ' '. Sets the match to blanks, tabulations, and control characters such as Enter (new line).
For example:
match("ab: cd","ab cd"); //returns 1 
match("ab: cd","ab\ncd"); //returns 1 
match("ab: cd","ab\tcd"); //returns 1
match("ab: cd","ab cd"); //returns 0 - only the first space is matched
Therefore, you need enter the following string in the "containing text" field;
: AddressRelationship: 
Note that in the above string there are spaces in the following locations;
:SPACEAddressRelationship:SPACE 

1 comment:

Thanks for the feedback!