Options

Permanent filters

RuleRule Member Posts: 34
I have a problem.
I want to make a permanent filter in a form during runtime.
I use this for hiding the data for the user.
When a user opens a form i will filter only those forms he can see.
But when the user removes the filter from the form he can see all the forms. I've tried to set a view but the result is the same. The only solution i see is to put the view during design time but then i can't retrieve the user id. Does someone has a solution for this. I suppose i'm not the only one having this problem. :?:
Realisations are only limited by the borders of imagination

Comments

  • Options
    HalMdyHalMdy Member Posts: 429
    On OnOpenForm trigger, try :

    SETFILTERGROUP(2);
    SETFILTER(...);
    SETFILTERGROUP(0);

    But ... what do you mean by "I cannot retrieve the user ID" ?
  • Options
    kinekine Member Posts: 12,562
    use FILTERGROUP for your Filter (look for FILTERGROUP in C/Side help)...

    set higher filter group, set filter, return filtergroup back to 0...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    RuleRule Member Posts: 34
    Thanks for the help.
    It does what it has to do.
    Concerning the User id i can't use the user id during design time.
    So i can't set the view of a form to
    where PurchaseHeader."Purchaser Code"=CONST(USERID)
    in design mode.

    But using a filtergroup does it during runtime
    Realisations are only limited by the borders of imagination
  • Options
    krikikriki Member, Moderator Posts: 9,090
    SETFILTERGROUP(2); 
    SETFILTER(...); 
    SETFILTERGROUP(0);
    

    This is correct but it is better to use a filtergroup of 6 or higher, because filtergroups 0 to 5 are reserved by Navision. Look into the help of "SETFILTERGROUP" for more info.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.