Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all. I'm not sure if this is possible, but if so could someone offer some guidance about how I can build it?
I want to build Section Access such that, for access type USER, QlikSense associates the User to their own Department, and then restricts the data to only show their Department. The aim is to not have to declare explicitly which Department each User should see, instead to have a rule that automates so that any User logged in can only see their Department.
I can identify the correct Department through an expression that connects the Username via OSUser() to their Department. So essentially I want QlikSense to take the result of this expression and apply security based on it.
For added complication, I would like to have access type ADMIN allowing a view of unrestricted data as well.
Any suggestions?
I ended up finding a way to do this in the front end, with the departments associated with each userID captured in a table. Since I am not using Section Access this means that I am not filtering out all of the unwanted data, so I can still do cross-department comparisons etc.
In the script I created a table of NetIDs connected to User Personnel Numbers, with a lookup to a temporary Current Positions table to find the user's current Department. So now Qlik associates the Department on the NetworkIDs table with the Department of a Position, and I can use this to filter expressions in the front end.
In the front end, I capture the part of the userID after the = sign in a variable: vUserNetID=upper(mid(osuser(),Index(osuser(), '=', 2)+1)). Now for all expressions for which I want data filtered only to include the users department, I start with =if(NetID=vUserNetID ...
Its a bit slow but it works.
Move the query to find the department for a particular user to backend and link it back to section acesss . something like the below
LOAD * INLINE [
UID , PWD, NTNAME, ACESSSTYPE,DEPARTMENT
A,A,*,USER,A
B,B,*,USER,B
]
Write the query to create a table structure like the below
DEPARTMENT:
LOAD * INLINE [
DEPARTMENT , DEPARTMENT_ACTUAL
A, HR
B,FINANCE
] ;
I ended up finding a way to do this in the front end, with the departments associated with each userID captured in a table. Since I am not using Section Access this means that I am not filtering out all of the unwanted data, so I can still do cross-department comparisons etc.
In the script I created a table of NetIDs connected to User Personnel Numbers, with a lookup to a temporary Current Positions table to find the user's current Department. So now Qlik associates the Department on the NetworkIDs table with the Department of a Position, and I can use this to filter expressions in the front end.
In the front end, I capture the part of the userID after the = sign in a variable: vUserNetID=upper(mid(osuser(),Index(osuser(), '=', 2)+1)). Now for all expressions for which I want data filtered only to include the users department, I start with =if(NetID=vUserNetID ...
Its a bit slow but it works.