Filter on on Field by variable FieldNo

aodaod Member Posts: 54
Hello together,

I have to limit the Customers some users see (or not). The "Responsibility Center" is not good for my case, because a Customer or User may only be in one Group. In my case Customers might be visible for more than one group of users..

I planned to do the following:

Add a INTEGER Field to the "User Setup" that contains the Group Number for the User.

Add 12 Boolean-Fields (I need 8 Groups + some extra) :

FieldNO FieldName
50101 vis_group1
50102 vis_group2
......
50112 vis_group12

.. So i thought I can set Filter for the different groups by calculating

VAR_FilterFieldNo :=50100 + "User Setup"."Group Number";

and set filter for the From on the Field with the calculated Number...

How can I do this ? Or do you have better Idea with same effect ?

thanks

Answers

  • ufukufuk Member Posts: 514
    You can apply variable field based filters to fieldrefs and then copy this filters to record.
    //OnOpenForm
    RecRef.OPEN(TableNo);
    FldRef := RecRef.FIELD(varFieldNo1); 
    FldRef.SETFILTER('%1',FilterString); //filter string is the value in User Setup table assigned for the user who opens the form
    FldRef := RecRef.FIELD(varFieldNo2);
    FldRef.SETFILTER('%1',FilterString);
    ...
    Rec.FILTERGROUP(6);
    Rec.SETVIEW(RecRef.GETVIEW);
    Rec.FILTERGROUP(0);
    

    Another possibility is:
    You can insert all the group id values into one field (eg seperated by comma) in the record to be filtered and do a *value* filtering.

    Hope this helps.
    Ufuk Asci
    Pargesoft
  • aodaod Member Posts: 54
    Thank you !

    The way you descriped does exactly what it should !
Sign In or Register to comment.