Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, April 13, 2014

Add filter control to the form in Dynamic AX

Hi,
Four method is to be added for achieving this feature in your form
1.  Add modified method the filter field (below code)

public boolean modified()
{
    boolean ret;
   
    ret = super();
   
        Table1_ds.executeQuery(); // Here Table1_ds is the datasource to be filetered
   
    return ret;
}
2.  Add QuerryFilter in global declaration of the form
public class FormRun extends ObjectRun
{
    QueryFilter queryFilter;
}
3.  Override the init method of the concern datasource where record to be filtered.
public void init()
{
    super();
   
        queryFilter = Table1_ds.query().addQueryFilter(Table1_ds.queryBuildDataSource(), "FieldName");
//Same as earlier Table1_ds is the data source and FieldName is the add range to the datasource query.
}
4.   At last add executeQuery for the same datasource.
public void executeQuery()
{
    // Get the filter value from the filter control.
    queryFilter.value(element.design().controlName("FormField").valueStr());
 //FormField is the filter that you added for proving range value in form.
    super();
}
Hope now it filters good.
Regards,


No comments:

Post a Comment

How find size of recordsortedlist in D365/AX 2012

Hi, This is the continuity of the previous article where we are now getting the size of recordsortedlist . if(recordsortedlist.len() >1) ...