Record.FilterGroup([Integer]) Method

Version: Available or changed with runtime version 1.0.

Gets or sets the filter group that is applied to a table.


[Group := ]  Record.FilterGroup([Group: Integer])


This method can be invoked using property access syntax.


 Type: Record
An instance of the Record data type.

[Optional] Group
 Type: Integer

Return Value

[Optional] Group
 Type: Integer



  • It's possible to use one of the internally used groups. If you do this, you replace the filter that Dynamics 365 Business Central assumes is in this group. If, for example, you use filter group 4 in a page, you will replace the filtering that is actually the result of applying the SubPageLink Property. This could seriously alter the way pages and subpages interact.
  • For performance reasons, filtergroup -1 does not support filtering on flowfields.
  • The maximum number of filtergroups is 255. Greater numbers will be ignored, so don't use them.


Using filter group 7 may cause factboxes to not work as intended.

A filter group can contain a filter for a Record that has been set earlier with the SetFilter Method (Record) or the SetRange Method (Record). The total filter applied is the combination of all the filters set in all the filtergroups.

When you select a filter group, subsequent filter settings by the SetFilter Method (Record) or the SetRange Method (Record) apply to that group.

All groups are active at all times. The only way to turn off a group is to remove the filters set in that group.

Filters in different groups are all effective simultaneously. For example, if in one group, a filter is set on customer numbers 1000 to 2000, while in another group, a filter is set on customer numbers 1800 to 3000, then only numbers in the range 1800 to 2000 are visible.

If you have filters on multiple fields in the same filter group, then only records matching all filters are visible. The only exception to this is filtergroup -1 where records only need to match at least one of the filters.

Dynamics 365 Business Central uses the following filter groups internally. These filtergroups shouldn't be used.

Number Name Description
-1 Cross-column Used to support the cross-column search.
0 Std The default group where filters are placed when no other group has been selected explicitly. This group is used for filters that can be set from the filter dialogs by the end user.
1 Global Used for filters that apply globally to the entire application.
2 Form Used for the filtering actions that result from the following:

- SetTableView Method (XMLport), SetTableView Method (Page)
- SourceTableView Property
- DataItemTableView Property.
3 Exec Used for the filtering actions that result from the following:

- SubPageView Property
- RunPageView Property
4 Link Used for the filtering actions that result from the following:

- DataItemLink Property (Reports)
- SubPageLink Property
5 Temp Not currently used.
6 Security Used for applying security filters for user permissions.
7 Factboxes Used for clearing the state of factboxes.

A filter set in a group different from filter group 0 cannot be changed by a user that uses a filter dialog to set a filter. If, for example, a filter has been set on customer numbers 1000 to 2000 in group 4, then the user can set a filter that delimits this selection further, but cannot widen it to include customer numbers outside the range 1000 to 2000.

Reset filter

To reset the filters in filter group 1, you add an empty filter to the group. To add an empty filter, to filter group 1, you must first set the filter group.


Then, for each field in the table that to which the Rec variable refers, set an empty filter.


Example 1

The following example uses the SetFilter Method (Record) to set a filter that selects records with No. field between 10000 and 20000. Then, the FilterGroup method returns the number for the filter group. No filter group was selected explicitly, so the filter is set in filter group 0. This value is stored in the varOrigGroup variable and displayed in a message box. Next, the FilterGroup method changes the filter group to 1. The new value is stored in the varCurrGroup variable and displayed in a message box.

        Customer: Record Customer;
        varOrigGroup: Integer;
        varCurrGroup: Integer;
        Text000: Label 'The original filtergroup is: %1';
        Text001: Label 'The current filtergroup is: %1';
    Customer.SetFilter("No.", '10000..20000');  
    varOrigGroup := Customer.FilterGroup;  
    Message(Text000, varOrigGroup);  
    varCurrGroup := Customer.FilterGroup(1);  
    Message(Text001, varCurrGroup);  

Example 2

The following example finds all customers where the Customer Name or Contact Name contains the string John.

    SearchString: Text;
    Customer.FilterGroup := -1;  
    SearchString := '@*John*';  
    Customer.SetFilter(Customer.Name, SearchString);  
    Customer.SetFilter(Customer.Contact, SearchString);  

See Also

Record Data Type
Get Started with AL
Developing Extensions