FILTERGROUPS

Developer101Developer101 Posts: 175Member
Been with NAV for years but there are some things always need relearning.

could be would achieve

FILTERGROUP(10)
SalesHeader.SETRANGE("No.",'10000');#
FORM.RUN(0,SalesHeader)

exactly same as

FILTERGROUP(10)
SalesHeader.SETRANGE("No.",'10000');#
FILTERGROUP((0)
FORM.RUN(0,SalesHeader)

Then what is the user of FILTERGROUP(0) --- I struggle to understand..

Thanks

Answers

  • Slawek_GuzekSlawek_Guzek Posts: 1,488Member
    It is not exaclty the same.

    If you omit FILTERGROUP(0) before FORM.RUN the filtergroup 10 will be your current one and user will see the filter and will be able to remove it.

    The form shows the filters, and let user remove them from the current filtegroup - no matter what filtergroup number it is. Default filtergroup is 0, and it is also 'current' filtegroup on all record variables, until you swith it. When you switch it from (default) filtergroup 0 to something other (10 in your case) the new filtergroup becomes 'visible' on forms.

    If you switch filtergroup to something (say 10), set filters in that filtergroup, and then switch to someting different (can be default 0, but also can be anyting else but 10), the filters in filtergroup 10 becomes hidden an non-removable from the user interface (the form), yet they still apply to your record.

    You could do
    FILTERGROUP(0)
    SalesHeader.SETRANGE("No.",'10000');#
    FILTERGROUP(10)
    FORM.RUN(0,SalesHeader)
    
    and that would work exactly the same as
    SalesHeader.SETRANGE("No.",'10000');#
    FILTERGROUP(10)
    FORM.RUN(0,SalesHeader)
    
    or this
    FILTERGROUP(10)
    SalesHeader.SETRANGE("No.",'10000');#
    FILTERGROUP(0)
    FORM.RUN(0,SalesHeader)
    
    or this
    FILTERGROUP(10)
    SalesHeader.SETRANGE("No.",'10000');#
    FILTERGROUP(5)
    FORM.RUN(0,SalesHeader)
    
    The filters remain hidded and non-removable as long as they have been set in different filtergroup than the one set on the record at the point of FORM.RUN call.
    Slawek Guzek
    Poszukuje programistow znajacych Microsoft Dynamics NAV
  • Developer101Developer101 Posts: 175Member
    Thanks Slawek

    For the information i am using NAV 2016. I will do more testing and will get back to the forum

    Thanks
Sign In or Register to comment.