FILTERGROUP (Record)
Use this function to change the filter group that is being applied to the table. You can also use this function to return the number of the current filtergroup. You cannot return the number of the filtergroup and set a new filtergroup at the same time.
A filtergroup can contain a filter for a Record that has been set earlier with SETFILTER or SETRANGE. The total filter applied is the combination of all the filters set in all the filtergroups.
[CurrGroup] := Record.FILTERGROUP([NewGroup])
CurrGroup
Data type: integer
The number of the current filter group.
Record
Data type: record
A record pointing to the table you want to work with.
NewGroup
Data type: integer
The number of the filter group you want to use.
Settings
There are filtergroups with numbers from 0 to 255.
Comments
When you select a FILTERGROUP, subsequent filter settings - by SETFILTER or SETRANGE - apply to that group.
All groups are active at all times. The only way to disable a group is to remove the filters set in that group.
Filters in different groups are all effective simultaneously; that is: if in one group, a filter is set on customer numbers 1000..2000, while in another group, a filter is set on customer numbers 1800..3000, the result will be that only numbers in the range 1800..2000 are visible.
C/SIDE uses 7 FILTERGROUPS internally:
Number
Name
Description
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.
This group is also used for the filtering action that is the result of the RunFormLink property on a form.
1 Global Not used, but may be used in the future.
2 Form Used for the filtering actions that result from the SETTABLEVIEW function; from the SourceTableView property; and from the DataItemTableView property.
3 Exec Used for the filtering actions that result from the SubFormView and RunFormView properties.
4 Link Used for the filtering actions that result from the DataItemLink and SubFormLink properties.
5
Temp
Not used, but may be used in the future.
6
Security
Used for applying security filters for user permissions.
This means that a filter set in a group different from FILTERGROUP 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..2000 in group 4, the user can set a filter that delimits this selection further, but cannot widen it to include customer numbers outside the range 1000..2000.
It is possible to use one of the internally used groups from C/AL. If you do this, keep in mind that in this way, you will replace the filter that C/SIDE assumes is in this group. If, for example, you use FILTERGROUP 4 in a form, you will replace the filtering that is actually the result of applying the SubFormLink property. This could seriously alter the way forms and subforms interact.
Answers
The key feature of filtergroups that I use is the fact that the filter is invisible and unremovable by the user.
filtergroup(29)
item.setrange("inventory posting group",'FINISHED');
filtergroup(0)
this sets a filter so the user can only see items that are finished goods
the other way is when I want a filter to be set a certain way.
I use an option choice and then that filter is only set by my code
I may give the user 3 choices and set each one with my specifics.
The filtergroup(0) puts any further filtering back in the standard filtering mode
but keeps my filters set.
to release my filters I have to enter filtergroup(29) again.
Thats how I use them
Steve
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
But would you give me more examples so that I could clearly understand them?
Thank you in advance.
Andwian
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I will check.
Andwian