FILTERGROUP Example

krikikriki Member, Moderator Posts: 9,112
edited 2007-02-21 in NAV Tips & Tricks
FILTERGROUPS are used in 2 ways:
1) when you want to put multiple filters on the SAME field
2) when you want to hide a filter from the users, so they cannot change/delete it

-Example for 1: I want Customers whose names start with ABC and have XYZ somewhere in their names
SETFILTER("Customer Name",'ABC*');
FILTERGROUP(6);
SETFILTER("Customer Name",'*XYZ*');
FILTERGROUP(0);

-Example for 2: : the use has to select an item from a certain Vendor and he may NOT change (or delete) the filer on the vendor.
recItem.RESET;
recItem.FILTERGROUP(6);
recItem.SETRANGE("Vendor No.",codVendorNo);
recItem.FILTERGROUP(0);
IF FORM.RUNMODAL(0,recItem) = ACTION::LOOKUPOK THEN BEGIN
  ...
END;
The FILTERGROUP 6 changes the filtergroup in which I put the SETRANGE, then I put the FILTERGROUP back to 0 (the standard one) so the user doesn't see/cannot change my filter on Vendor no.
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Comments

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    I would add one more area of use - reports.

    You can do:

    Filtergroup(6);
    setrange(filed,your filter);
    Filtergroup(0);

    and then if even you expose the filtered field to the user on the request form, both filters, your and typed by the user, apply.

    Regards,
    Slawek
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Sign In or Register to comment.