The evolution of filters

To create a complex filter, a developer usually uses command "FILTERGROUP" to place different filters for the same field. In the first Microsoft Dynamics NAV Windows-based versions, developers were able to use filtergroups starting from 0 to 255. Some of them were reserved and used within the application like filtergroup 2 used by properties SubFormView, DataItemTableView or when you use command SETTABLEVIEW. There was also a reserved filtergroup 1, which was supposed to be a "Global filter" as it was in the DOS version.

Beginning with version Microsoft Dynamics NAV 5.0 SP1 build 28913, Microsoft introduced filtergroup 1 functionality.

What is a "Global filter"?

Let's explain this by using a small example. We've created two functions with two different variables linked to the same table. In our example we used table 14 "Location" but you can use any NAV table. The only one rule is to have the same table in both records. Even better, you can set up them as normal or as temporary as it has no difference in our example.

After executing the code in the versions before Microsoft Dynamics NAV 5.0 SP1 build 28913, you will always get a message:

This is because you use different variables even linked to the same table. In newer Microsoft Dynamics NAV versions, you'll get the message:

This example illustrates global filter functionality.

Why do we need this?  

To answer to this question, we will take an example from a  Microsoft article  related to this new "FILTERGROUP" functionality:

"For example, in a company that has several departments in Microsoft Dynamics NAV 5.0 with Service Pack 1, a user can view data or post data for other departments. However, you expect that the data for a specific user is filtered on a dimension code so that the user cannot view or post data for other departments. Therefore, you require a new platform feature to provide the functionality to limit the general visibility for users."

This example presents one of the "General filter" usage scenarios. In this case you can place a filter on each table where department information is stored at the moment user starts Microsoft Dynamics NAV application.

Do not forget, that functions FIND, FINDFIRST, FINDLAST, FINDSET, COUNT, ISEMPTY will use these filters so additional changes to find for example last record in a table will be required (important for posting procedures when insert new record into ledger entries).

Even more, starting from Microsoft Dynamics NAV 2009 you can use more than 255 filter groups. Microsoft support stated that you can use filtergroups for any integer number. We've tested with filtergroup up to 100.000 and it works .

We expect that this article encouraged you to use new features coming with FILTERGROUP function in your application.

The official Microsoft article related to the new "FILTERGROUP" functionality can be found at PartnerSource under the follow

日博电竞入口数据 im中国电竞官方外围 蜂鸟电竞登录比赛网 电竞体育(武汉)观看全球网址 esg电竞现场查询 宝博电竞联赛v8.10 IOS版