Hide fields in tabluar forms

r_schuelerr_schueler Member Posts: 28
edited 2001-01-14 in Navision Financials
Hi,

is there a solution for the following problem:

I want to hide some fields in a tabular form (for example form 31) and only show them to users with a special permission.
In a card form this is no problem. I have created a boolean field in table 91 (User table), inserted some code in the OnOpenForm trigger of the card form to set the VISIBLE flag depending on that field. This works fine in this case, but in a tabular form the users are able to make the fields visible again if they use the "show column" menu. I do not want to disable this menu, because I think it is very useful.

What other ways exist to hide fields ?

Thanks for your help.

Best regards
Rainer

Comments

  • mfabianmfabian Member Posts: 187
    I didn't try it but the following should work:

    Let's assume the field you only want to show to users with permission is "salary". Don't include this field in the table. Instead write a

    function "ShowSalary" : Decimal;

    Begin
    If _user_has_permission_ then
    exit(salary)
    else
    exit(0)
    end;

    You can now include this function to the table like a normal field: Include the Salary field to the table and change the sourceExpression from "Salary" to "ShowSalary". That's it!


    If you need users with permission to update/change the salary you might need to create a global variable which you display. This variable is populated OnAfterGetRecord and modifies the real salary on it's OnValidate-trigger.

    Marcus


    Marcus Fabian
    m.fabian@thenet.ch
    +41 79 439 78 72

    [This message has been edited by fabian (edited 14-01-2001).]
    With best regards from Switzerland

    Marcus Fabian
Sign In or Register to comment.