FILTERGROUP and RUNMODAL

BeliasBelias Member Posts: 2,998
hi everyone, i have a little problem with filtergroup...i can't get it work using this code:
CLEAR(TBPTSDescr);
CLEAR(FRMPTSDescr);
TBPTSDescr.FILTERGROUP(10);
IF "Phase Code" <> '' THEN
  TBPTSDescr.SETRANGE(Phase,"Phase Code");
IF "Task Code" <> '' THEN
  TBPTSDescr.SETRANGE(Task,"Task Code");
IF "Step Code" <> '' THEN
  TBPTSDescr.SETRANGE(Step,"Step Code");
FRMPTSDescr.SETTABLEVIEW(TBPTSDescr);
FRMPTSDescr.SETRECORD(TBPTSDescr);
FRMPTSDescr.RUNMODAL;
TBPTSDescr.FILTERGROUP(0);
thanks in advance
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog

Answers

  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    edited 2008-10-29
    Hi

    For form need use group 2 - command TBPTSDescr.FILTERGROUP(2);
    CLEAR(TBPTSDescr);
    CLEAR(FRMPTSDescr);
    TBPTSDescr.FILTERGROUP(2);
    IF "Phase Code" <> '' THEN
      TBPTSDescr.SETRANGE(Phase,"Phase Code");
    IF "Task Code" <> '' THEN
      TBPTSDescr.SETRANGE(Task,"Task Code");
    IF "Step Code" <> '' THEN
      TBPTSDescr.SETRANGE(Step,"Step Code");
    TBPTSDescr.FILTERGROUP(0);
    ...
    FRMPTSDescr.RUNMODAL;
    
  • BeliasBelias Member Posts: 2,998
    Hi

    For form need use group 2 - command TBPTSDescr.FILTERGROUP(2);
    :-k this is not true...you can use every number for filtergroups...it's not compulsory (and also not recommended) to use no.2 filtergroup, because MS use this group and you can interfere with it
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Hi

    Yes You can use any group but for forms only 2

    From help:
    2 Form Used for the filtering actions that result from the SETTABLEVIEW function; from the SourceTableView property; and from the DataItemTableView property.
  • BeliasBelias Member Posts: 2,998
    I extracted this directly from the online help...
    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.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Yes
    You right
    Sorry ](*,)

    Try this
    CLEAR(TBPTSDescr);
    CLEAR(FRMPTSDescr);
    TBPTSDescr.FILTERGROUP(10);
    IF "Phase Code" <> '' THEN
      TBPTSDescr.SETRANGE(Phase,"Phase Code");
    IF "Task Code" <> '' THEN
      TBPTSDescr.SETRANGE(Task,"Task Code");
    IF "Step Code" <> '' THEN
      TBPTSDescr.SETRANGE(Step,"Step Code");
    TBPTSDescr.FILTERGROUP(0);
    FRMPTSDescr.SETTABLEVIEW(TBPTSDescr);
    FRMPTSDescr.RUNMODAL;
    
  • BeliasBelias Member Posts: 2,998
    no problem, because
    yes, it works! thank you!
    but why? :-k
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Yaroslav_GaponovYaroslav_Gaponov Member Posts: 158
    Likely NAV make same code :D
    CurrGroup := rec.FILTERGROUP;
    for i := 0 to MaxGroup do
      if i <> CurrGroup then SetHideFilter()
        else SetFilter();
    
  • BeliasBelias Member Posts: 2,998
    Likely NAV make same code :D
    CurrGroup := rec.FILTERGROUP;
    for i := 0 to MaxGroup do
      if i <> CurrGroup then SetHideFilter()
        else SetFilter();
    
    :shock: where's this code? i can't understand it...
    anyway...solved!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    It means that user can see filters in current filtergroup.If you didn't set the filtergroup back to 0, user can see filters in filter group 8 or 2 or another one you used last time... it is good practice to set it back to 0 because that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • BeliasBelias Member Posts: 2,998
    ok, and where i can find this code in std NAV?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • kinekine Member Posts: 12,562
    Belias wrote:
    ok, and where i can find this code in std NAV?

    Nowhere... it was only example how it works "inside" the C/Side... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.