Problem with setting a (simple) filter to Item List

NagiNagi Member Posts: 151
Hi,

I'm fairly new to Navision, and I have a customer (using Navision 3.7a) that wants an automatic filter placed on the Item List form when accessed from the Item Card form (by pressing F5 or clicking the appropriate Menu Item link). The filter should exclude any item that is currently blocked.

Setting this filter isn't very difficult. I've found several properties that I can manipulate (such as RunFormView). The following CAL code also seems to do the job (when inserted into Menu Item -> Item List):

Itemrec.RESET;
Itemrec.FILTERGROUP(2);
Itemrec.SETRANGE(Blocked, FALSE);
Itemrec.FILTERGROUP(0);
IF Itemrec.FIND('-') THEN
;
CLEAR(ItemListform);
ItemListform.SETTABLEVIEW(Itemrec);
ItemListform.SETRECORD(Itemrec);
ItemListform.RUN;

My problem is that the filter also needs to be dynamically changed if the user wants to see all items (and not just the ones that aren't blocked). Any filter I've managed to apply to the form can't be turned off at run-time. The filter is applied to the form, and any subsequent filters that are used appear to be subordinate to my Blocked = FALSE filter.

I would appreciate any help on this.

Answers

  • MalajloMalajlo Member Posts: 294
    Try this:

    Put code on Form:31
    Form - OnOpenForm()
        filtergroup(2) ;
        setrangE(blocked,false) ;
        filtergroup(0) ;
    
    ...
    Button to show all items:
    <Control1000000017> - OnPush()
    filtergroup(2) ;
    setrange(blocked) ;
    filtergroup(0) ;
    
  • NagiNagi Member Posts: 151
    Hi,

    Thanks for the help! :D

    Although I would have liked to be able to remove the filter using standard Navision short cuts (shift+ctrl+F7), I guess it has to be done with a button control.
  • SunsetSunset Member Posts: 201
    Nagi wrote:
    Hi,

    Thanks for the help! :D

    Although I would have liked to be able to remove the filter using standard Navision short cuts (shift+ctrl+F7), I guess it has to be done with a button control.

    Filtergroups are used to make sure the users don't remove the filters. So if you want the users to be able to remove filters using default navision, don't use the filtergroup commands
    Don't just take my word for it, test it yourself
Sign In or Register to comment.