# Pb with filter

**URL:** <https://www.dynamicsuser.net/t/pb-with-filter/15278>\
**Category:** Developer Forum\
**Created:** [April 28, 2005, 9:29am UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278 "2005-04-28T09:29:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vince](https://www.dynamicsuser.net/u/vince)\
**Post date:** [April 28, 2005, 9:29am UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/1 "2005-04-28T09:29:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kashperuk](https://avatars.discourse-cdn.com/v4/letter/k/ecae2f/32.png) [@kashperuk](https://www.dynamicsuser.net/u/kashperuk)\
**Post date:** [April 28, 2005, 7:10pm UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/2 "2005-04-28T19:10:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mugur](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@Mugur](https://www.dynamicsuser.net/u/Mugur)\
**Post date:** [April 28, 2005, 9:13pm UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/3 "2005-04-28T21:13:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vince](https://www.dynamicsuser.net/u/vince)\
**Post date:** [April 29, 2005, 8:43am UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/4 "2005-04-29T08:43:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mugur](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@Mugur](https://www.dynamicsuser.net/u/Mugur)\
**Post date:** [April 29, 2005, 9:47am UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/5 "2005-04-29T09:47:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vince](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vince](https://www.dynamicsuser.net/u/vince)\
**Post date:** [April 29, 2005, 12:23pm UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/6 "2005-04-29T12:23:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mugur](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@Mugur](https://www.dynamicsuser.net/u/Mugur)\
**Post date:** [April 29, 2005, 1:09pm UTC](https://www.dynamicsuser.net/t/pb-with-filter/15278/7 "2005-04-29T13:09:48Z")

</div>

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
