Filtergroup...Never Used

roshanthaparoshanthapa Member Posts: 90
Can Anybody guide me regarding the filtergroups. I read the posts regarding the filtergroups. I don't understand where the filtergroups are defined.

For example, I use

FILTERGROUP(X);
<Some codes>
FILTERGROUP(0);

Where is the filtergroup(X) defined. I have never used the filtergroup. Please tell me in what situation to use filtergroup and how do we define and use the filtergroups.

Sorry if my question is wrong but I want to know more about the filtergroups than shared in the forum itself. I read all posts.

Comments

  • roshanthaparoshanthapa Member Posts: 90
    As I understood the whole concept, iy looks like when we use
    filtergroups(2), only the filters of SETTABLEVIEW , SourceTableView and DataItemTableView property will be activated and when we apply filtergroups(0), all the filters are activated.


    But later some people are saying not to use the internal groupfilters of Navision. They say, use groupfilters more than 6. What does that mean? I could not find any groupfilter(>6) anywhere, where do I find it (the definition) or define it?
  • BeliasBelias Member Posts: 2,998
    I usually use
    TBa.Filtergroup(2);
    TBa.setfilter...
    TBa.setrange...
    TBa.Filtergroup(0);

    and everything have gone well up to now...

    with this instruction you can set unremovable filter on a table, for example when you want to show only some records in a form...remember to use the same variable to filtergroup and setfilter/setrange
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • roshanthaparoshanthapa Member Posts: 90
    Thanx Belias, Thanx for the help. But putting the same thing in all situations is a kludge even if you solve the problem.

    But I want somebody expert to put more light on this topic like David Singleton, Kirki, Van Dyck or Erik. I also welcome help from other people.

    Kindly give me a more information regarding this, all experts.
  • AlbertvhAlbertvh Member Posts: 516
    Hi

    Extract from help
    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.
  • roshanthaparoshanthapa Member Posts: 90
    Thanks Albertvh,
    I have already read that in help file. I wanted to know how we create new filtergroup and how to use them as an example.
  • matttraxmatttrax Member Posts: 2,309
    You can use any number you want in the filtergroup. I use 10 all the time so that no one can remove the filter.

    There's really not much to it.
    Rec.FILTERGROUP(10);
    Rec.SetMyFilters;
    Rec.FILTERGROUP(0);

    Now they see what you tell them to see, nothing more. They can limit it all they want from there, but the filters YOU set will never be removed.
  • SLF25SLF25 Member Posts: 37
    But I want somebody expert to put more light on this topic like David Singleton, Kirki, Van Dyck or Erik. I also welcome help from other people.

    Don't we all. :lol:
  • jlandeenjlandeen Member Posts: 524
    =; LOL so I guess the rest of us are just chopped liver?
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Check out codeunit 230 - GenJnlManagement. This is where the use of FILTERGROUP is more apparant in terms of the application.

    This codeunit is called when you open the General Journal, Sales Journal, etc.
  • Alex_ChowAlex_Chow Member Posts: 5,063
    SLF25 wrote:
    But I want somebody expert to put more light on this topic like David Singleton, Kirki, Van Dyck or Erik. I also welcome help from other people.

    Don't we all. :lol:

    Everyone that contributes is an expert one way or the other. The only difference between people who are the MVPs and people who are not is that the MVPs are addicted to the forums. Nothing more. :wink:
  • kinekine Member Posts: 12,562
    But I want somebody expert to put more light on this topic like David Singleton, Kirki, Van Dyck or Erik. I also welcome help from other people.

    Hey, I am jealous... :mrgreen:

    anyway:

    You can imagine filter groups as different layers of filters on the record. Each layer is independent on other layers. Resulting filter is INTERSECTION of all the layers. User can change only filters in layer 0. Other layers are used for filters from different sources. You can define filter in form properties (one layer), you can define filter when you use the form as subform (another layer), you can define additional filter through C/AL code, etc. and you want to apply all that filters together. It is why the FILTERGROUPS are used. The number of the filtergroup is just no. of the layer in range 0..255.

    It means you can prevent user to remove your filter by setting that filter in another filtergroup than 0, where it is by default.

    Or you can use filtergroup to make intersection of different filters on same field by setting them in different filtergroups.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,115
    SLF25 wrote:
    But I want somebody expert to put more light on this topic like David Singleton, Kirki, Van Dyck or Erik. I also welcome help from other people.

    Don't we all. :lol:
    Too much honour. :oops: :oops: :oops:
    Alex Chow wrote:
    Everyone that contributes is an expert one way or the other. The only difference between people who are the MVPs and people who are not is that the MVPs are addicted to the forums. Nothing more. :wink:
    I couldn't have better defined a Dynamics NAV MVP! :mrgreen:
    And this probably also is valid for all other MVP's.

    Oh, I would almost forgot this: http://www.mibuso.com/forum/viewtopic.php?t=16659
    And if you search for "FILTERGROUP" and for author "kriki", you will find other posts about filtergroups.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ssinglassingla Member Posts: 2,973
    Everyone that contributes is an expert one way or the other. The only difference between people who are the MVPs and people who are not is that the MVPs are addicted to the forums. Nothing more.

    Feeling ignored :(:(
    May be a junior functional is not good enough........ :|
    CA Sandeep Singla
    http://ssdynamics.co.in
  • roshanthaparoshanthapa Member Posts: 90
    Hey people, I didn't mean to say that someone here is superior and someone is inferior. You people just took it in negative sense or maybe my words are wrong.

    I just wanted to say anyone who can give me more advice this issue like david is known for detailed explanation, that's it. I just wanted somebody to explain me more on this issue that's it. There was no other intention of making anybody inferior, ok?
  • borjaghborjagh Member Posts: 19
    What I do, is the following:
    At first, I calculate the current filtergroup; after that, I apply a filtergroup using a number > 6, so no one can remove the filter. And finally, I apply the FilterGroup it had before doing my own filters.

    intCurrentFilterGroup:=Rec.FILTERGROUP;
    Rec.FILTERGROUP(10);
    Rec.SetMyFilters;
    Rec.FILTERGROUP(intCurrentFilterGroup);

    In this manner I'm always sure I don't interfere with standard behavior, and make my filters invisible and irremovable by the user. I have had good results always doing in this manner.
    I think in filtergroups like work spaces where we can apply filters. The help says numbers 0 to 6 are used or reserved to use internally, so I don't use these numbers. Filtergroup 0 is visible and changeable by the user.

    Perhaps, I'm doing an extra job calculating the current filtergroup, I'm not sure, but it works well for me.
  • krikikriki Member, Moderator Posts: 9,115
    Nav 5.0 uses FILTERGROUP 6 for Security
    6 Security Used for applying security filters for user permissions.

    So better start from 10 (in case they decide to add other reserved filtergroups) :mrgreen:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • David_SingletonDavid_Singleton Member Posts: 5,479
    Hi roshanthapa, not sure what the fuss is all about, I think this is an excellent post, and an excellent topic. :mrgreen:

    On the
    Dynamics Book Wiki there is this page about filter groups that may help you.

    Filter groups in NAV - Dynamics
    David Singleton
  • gisongison Member Posts: 128
    Belias wrote:
    I usually use
    TBa.Filtergroup(2);
    TBa.setfilter...
    TBa.setrange...
    TBa.Filtergroup(0);

    and everything have gone well up to now...

    with this instruction you can set unremovable filter on a table, for example when you want to show only some records in a form...remember to use the same variable to filtergroup and setfilter/setrange

    Dears,
    There is one thing I'm confused, why we always set a filtergroup 2 then go back to filtergroup 0 immediately...... :?
  • BeliasBelias Member Posts: 2,998
    TBa.Filtergroup(2); 
    TBa.setfilter... 
    TBa.setrange... 
    TBa.Filtergroup(0);
    

    ...this is only an example...
    between TBa.Filtergroup(2); and TBa.Filtergroup(0); there are only filters you don't want the user to remove...

    BTW: reading this thread, you surely learnt (as I do) that is better to use filters with nr. >6 (e.g. 10) in order to not interfere with standard...
    TBa.Filtergroup(10); 
    TBa.setfilter(name,'ME');
    TBa.setrange(city,'MILAN'); 
    TBa.Filtergroup(0); 
    TBa.setfilter(surname,'woooo');
    

    in this example, in the resulting list form with these filters applied, if the user presses ctrl+shift+f7, he will toggle only the last filter (surname).
    also if he presses ctrl+f7 he will only see the surname filter line...(and other eventual filters he applied)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    You are going back to group 0, because if you are using variable which can lead to Rec on form, than user will be working in the last used Filter group. It means when you set the 0 group back, you are sure, that the user will see only filters in group 0 and not the last used...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gisongison Member Posts: 128
    kine wrote:
    You are going back to group 0, because if you are using variable which can lead to Rec on form, than user will be working in the last used Filter group. It means when you set the 0 group back, you are sure, that the user will see only filters in group 0 and not the last used...

    Thanks Kine,

    So it's mean we'll probably set filtergroup back to 10 while we want to use it again? It's also can prevent user change the filtergroup by tool bar or something.....? :-s
Sign In or Register to comment.