Pb with filter

Hi, I have created a form with a grid. The grid displays the data coming from a view. The datasource of this view has the following init method: public void init() { QueryBuildDataSource qbds; Query query = new Query(); ; qbds = query.addDataSource(tablenum(View_Clients)); qbds.orderMode(OrderMode::GroupBy); qbds.addSortField(fieldNum(View_Clients,AccountNum)); qbds.addSortField(fieldNum(View_Clients,CustGroup)); qbds.addSortField(fieldNum(View_Clients,Name)); qbds.addSortField(fieldNum(View_Clients,Street)); qbds.addSortField(fieldNum(View_Clients,ZipCode)); qbds.addSortField(fieldNum(View_Clients,City)); qbds.addSortField(fieldNum(View_Clients,Phone)); qbds.addSortField(fieldNum(View_Clients,Telefax)); qbds.addSortField(fieldNum(View_Clients,County)); View_Clients_ds.Query(query); super(); } I don’t if there is a link with this method but I can’t use the filter by clicking on the icon at the top of the screen ( the funnel ). The filter form is launched and I can’t create a new line ( Ctrl + N). If someone has a solution… Thanks, Vince

That’s because of the OrderMode::GroupBy. I haven’t found a solution for this. I would like to know the solution if there is one too.

Hi You can add the following piece of code right below the last .addSortField() statement. This will automatically popultate the filtering screen with ranges. qbds.addRange(fieldNum(View_Clients,AccountNum)); qbds.addRange(fieldNum(View_Clients,CustGroup)); qbds.addRange(fieldNum(View_Clients,Name)); qbds.addRange(fieldNum(View_Clients,Street)); qbds.addRange(fieldNum(View_Clients,ZipCode)); qbds.addRange(fieldNum(View_Clients,City)); qbds.addRange(fieldNum(View_Clients,Phone)); qbds.addRange(fieldNum(View_Clients,Telefax)); qbds.addRange(fieldNum(View_Clients,County)); Cip

Indeed, your code works. But it is not exactly I want to do. It is still impossible to add new lines (Ctrl + N) in the filter window. When I remove the “order by” in the init method of the datasource it functions but in my case, “order by” is very important, so I can’t remove it. Any other idea… Vince

You can create your own filtering screen with a temporary table as the datasource, and allow user to add ranges and sortings for the fields from your view. Otherwise you can check the code in SysQueryFrom (which is the Axapta form for filtering) and see how you can bypass the Group BY validation. Regards, Cip

ok. Another question about filter: In my grid, there are data that come from the datasource (so I can make filter using the right button of the mouse) but there are also data that come from methods that I have made. For example there is a field composed of a check box that is “true” if a condition about the client is verified. The problem is that I can’t make a filter by clicking on the right button of the mouse. When I click there are only three posibilities (hide, configuration and info). Any ideas?.. Vince

Yep. In this case you will not be able to make any filtering. I also had this problem, and solved it by creating another table, temporary, having the calculated fields in the first datasource as regular fields. Then i created a new form with the temporary table as datasource. This is ok, but the problem is that you have to populate the tmp every time the form is run (which slow down the system). Hope this helps. Regards, Ciprian