Monday, 18 April 2011

Blocking user access to a field using OMIT

This is something that comes up every so often.  A question like, "we have sensitive data (such as salary!) in our system that we only want some users to see".

This is all very straightforward on SBS where collaboration is not available.  Simply lock down the tab which has the sensitive data displayed using, for example, a condition based on the OSUser() function.

On an Enterprise server, where users can create their own objects, you don't want them to even see that the field is there.

We can achieve this using the OMIT field in Section Access.  At a simple level, if you only have one field to hide, you can have the OMIT in the main Section Access table.  If you want to perhaps OMIT several fields, then the creation of a group of fields is the thing to do and then just link the user to the group ID.

In the example below, when user1 logs in they will not see Field1 or Field2.  When user2 logs in, they will not see Field2 or Field3.



Section Access;
LOAD * INLINE [
    ACCESS, USERID, OMITGROUP
    ADMIN, admin, 
    USER, user1, group1
    USER, user2, group2
];


LOAD * INLINE [
    OMITGROUP, OMIT
    group1, Field1
    group1, Field2
    group2, Field2
    group2, Field3
];




Section Application;


Fields:
LOAD * INLINE [
    Field1, Field2, Field3, Field4, Field5
    Value1, Value2, Value3, Value4, Value5
];



Stephen Redmond is CTO of CapricornVentis a QlikView Elite Partner

6 comments:

  1. Thanks for that! :)

    /dimi

    ReplyDelete
  2. I made a reference to your great blog at integration.qlik.com/slides if you don't mind?

    ReplyDelete
  3. hello i 'm new in QlikView. I tried your example but even if i enter as user1 or user2 i can see all fields like admin.
    I also unchecked from "Remember
    Login Credentials Until QlikView Exits option" in User Preferences

    ReplyDelete
  4. The field names must all be in upper case in Section Application. Section Access renders them as upper automatically.

    ReplyDelete
  5. If you are trying to do this in Qlik Sense, be careful not to misspell your admin user name, or you will lose access to your app. Otherwise it works as intended.

    ReplyDelete

Note: only a member of this blog may post a comment.