Label Search – Exact Match in Custom SSRS Reports

Ever wanted to search for an exact label using the Label search form without having to click the “…” in a property window?  If not, then you probably haven’t worked with custom SSRS reports too often.

As with all UI pieces, it is recommended that you use labels for all static text, especially for column labels.  When working with SSRS reports, you have to use the Label editor from the tools menu in AX.  When opened in this manner, the label editor will search for close matches, often returning many labels that are not useful.  To get around this, we’ll make a small change to the SysLabelSearch form.

To start, create a new group under Group1 (Group1 holds the SearchString StringEdit).  For the newly created group, called SearchGroup in this example; set the Width property to Column width, and set the Columns property to 2.  Drag the SearchString StringEdit from Group1 into SearchGroup.  Now, add a checkbox to SearchGroup, and name it cbExactMatch.  Set the AutoDeclaration property on the cbExactMatch checkbox to Yes, the Label property to “Exact match”, and the DataMethod property to “exactMatch” (this method will be created shortly).


Open the code to the form, and add a NoYesId variable named exactMatch to the classDeclaration:

SysFormSplitter_Y       formSplitter;
int                     currentHeight;

NoYesId                exactMatch;       // Kyle - Find exact match


Create a new edit method named exactMatch with a return type of NoYesId.  The method will set the exactMatch variable added to the classDeclaration:


// Kyle - Find exact match
edit NoYesId exactMatch(boolean _set, NoYesId _value)
    if (_set)
        exactMatch = _value;

    return exactMatch;

Change the method declaration of the labelSearch method to use the exactMatch variable as the optional parameter setter for the _findExactPhrase parameter:


public void labelSearch(str _text = searchString.text(), boolean _findExactPhrase = exactMatch) // Kyle - Find exact match


Modify the pack method to include the exactMatch variable (so that the lastValue is saved for the checkbox):


// AOSRunMode::client
public container pack()
    return [SysLabelEdit::lastValueVersion(),
            exactMatch];    // Kyle - Find exact match


Likewise, modify the unpack method to accept the exactMatch from lastValue. Replace line 21 with the following:

// Kyle - Find exact match -->
if (conLen(packed) == 8)    // For people who have old last values
    [version, languageId, notUsed_1, notUsed_2, autoSearchValue, notUsed_3, labelModuleId, languagePack] = packed;
    [version, languageId, notUsed_1, notUsed_2, autoSearchValue, notUsed_3, labelModuleId, languagePack, exactMatch] = packed;
// Kyle - Find exact match <--


The above code ensures that a user won’t get an error when the form is first opened after the modifications.  At all times after, the else block will be used.


When you open the form, you should see the new Exact match checkbox (it’ll be unchecked by default the first time the form is opened by each user).  Search for Item Number with Exact match unchecked:


In my DEV environment, the search returned 275 results over 45 seconds.  Additionally, I now have to search within the results to find the exact label.

Now, clear the search.  Search again for Item Number, this time, checking the Exact match checkbox:


This time, the search returned only 9 results, all of which are an exact match for the phrase we typed in the search box.  It also took only one second to return all results.

Hopefully, this simple example helps some of you in your UI design activities.

Kyle Self, Sr. Technical Consultant, AKA Enterprise Solutions

By | 2017-10-21T20:26:34+00:00 April 17th, 2013|Tech Tips|3 Comments
Alternative Text

Contributor: AKA Enterprise Solutions

AKA is comprised of professionals with deep experience in business, technology, and their respective industries. Our team members regularly share their knowledge and expertise through blog articles. We hope you find them helpful, and we welcome your comments.


  1. AX April 18, 2013 at 1:06 pm - Reply


  2. Parker Jacobs April 18, 2013 at 1:09 pm - Reply

    Thanks Kyle, this is very helpful! I would like to add to your post that the use of ” around your search criteria will limit your search results. If you searched “”, this would return all labels that ended with Item Number. As for searching for a label that matches the exact criteria, one would simply have to use “” as their search criteria to retrieve the labels that match.

  3. Kyle Self April 18, 2013 at 7:11 pm - Reply

    Hey Parker,

    Thanks for your response. That is some very useful information for those who are working in an environment where modifying a standard object outside of a specified enhancement is not allowed. Additionally, using these special characters offers some rather powerful label searching tools beyond just a simple exact match.
    Thank you for your contribution!

Leave A Comment