Filter groups are used to apply filters that cannot be removed by the user. This recipe will show you how to write code to utilize them and what to watch out for.
Create a new codeunit from Object Designer.
Add the following global variables:
Name
Type
Subtype
CurrFilterGroup
Integer
Customer
Record
Customer
Add the following code to the
OnRun
trigger of the codeunit:CurrFilterGroup := Customer.FILTERGROUP; Customer.FILTERGROUP(255); Customer.SETRANGE("No.", '50000'); Customer.FILTERGROUP(CurrFilterGroup); Customer.FINDFIRST; MESSAGE('Filters: %1\First Customer: %2', Customer.GETFILTERS, Customer.Name);
Save and close the codeunit.
A FILTERGROUP is used to set filters on a Record
variable that cannot be removed by the user. This function takes in a single integer as a parameter between the numbers 0 and 255. Although you can use numbers one to six, they are reserved by the system and manually assigning filters to those...