Form Records Filtering

Hi All,

I added a range to filter records in datasource executeQuery() method, this works fine when opening form but if I set manually a filter in the grid header, the range set in ExecuteQuery() method are not applied.

I used view as my data source and also I need to give the option to filter the records.

Regards,

Abhishek

Can you post your code here…,it will help to analyze if anything is incorrect.

Hi Saddaf,

Thanks for your quick reply.

Execute Query :

if(field1.valueStr())

{

formDataSource.query().dataSourceNo(1).addRange(fieldnum(table,fieldId)).value(SysQuery::value(field1.valueStr()));

}

super();

Regards,

Abhishek

Hi Saddaf,

When I open the form I am getting the desired records i.e. based on the query Ranges I have set. but the problem happens when I try to filter the records in the grid.

Thanks,

Abhishek

can you try using datasource_ds.reread();

can you try using datasource_ds.reread();

Hi Rohit,

I tried using it before the super() of the execute Query() method but it’s still not working. Shall I use it in some other place??

Thanks,

Abhishek

dunno please try this https://community.dynamics.com/ax/b/mafsarkhan/archive/2010/05/26/refresh-reread-research-executequery-which-one-to-use.aspx

Hi Abhishek,

what is happening here is your original query is getting accumulated with a range everytime it is called.

There are 2 ways to overcome this.

  1. Clear range on datasource everytime executequery is called.

  2. Or, save your original query in some other query initially and then call that everytime to add range.