Creating custom instant search filters in Ax 2009 and 2012

 

The majority of data search filters in Dynamics AX are not instant. Normally, the user types in search criteria and then has to press some button or the Enter key in order to execute the search and display the results.

This is acceptable for most people and in most circumstances. But, I have been asked couple of times to enhance the standard search filter to reflect user input instantly upon typing and display filtered data.

In this recipe, to demonstrate how this could be done, we will modify one of the standard Dynamics AX forms. We will change the behavior of the Name filter in the Contacts form in the CRM module to perform instant search upon the user typing.

How to do it…

  1. Open the control

  2. 2. Override its textChange() with the following code:

    public void textChange()
    {;
    super();
    this.modified();
    }
    
  3. 3. Edit its modified() method code by changing the following line:

    nameFilter = this.text();
    
  4. to:

    public boolean modified()
    {
     boolean ret;
     str nameFilter;
     ret = super();
    
     nameFilter = '*'+this.text()+'*';
     Bill_Table_ds.filter(fieldnum(Bill_Table,CustName),nameFilter);
    
     return ret;
    }
    
  5. 4. Override the control’s enter() with the following code:

    public void enter()
    
    {;
    super();
    this.setSelection(
    strlen(this.text()),
    strlen(this.text()));
    }
    
    Instantfilter
    

Read more at http://tutorial.programming4.us/windows_server/Microsoft-Dynamics-AX-2009—Working-with-Data-in-Forms—Creating-custom-instant-search-filters.aspx#OzgxiVH8z6xHX8ye.99

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s