Filter data based on Selection in Ax

HI,

To get data based on the selection of dates/enum values, we can use the below process to get the accurate data. The same logic can be used while opening the from as well.

1. declare a variable in “class declaration”

Mzk_monthYear      month;

2. to get the data filtration while opening form, assign the value for the above declared variable in init() of form

month = mthofYr(today());

3. build the query in data source level init() method

super();

queryBuildRange = Mzk_JapanesPayrollEntry_ds.query().dataSourceTable(tableNum(Mzk_JapanesPayrollEntry)).addRange(fieldNum(Mzk_JapanesPayrollEntry, Mthyr));

4. pass the value to the query in “executeQuery()”

queryBuildRange.value(int2str(any2int(month)));

super();

5. to get the data based on any filtration, assign the value of the global variable in modified method of the field at form DS level.

month = monthyear.selection();

Leave a comment