Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have following data
Table:
country,Region,orders,sales
Malaysia,ASP,100,1000
Singapore,ASP,200,2000
India,ASP,300,500
Egypt,EMEA,600,700
France,EMEA,400,900
Mexico,LAM,600,800
I wrote the section access like below
ACCESS, USERID,LOCATION_ID,LOCATION_GROUP_ID1
USER, test, *, ASP
USER, test, MEX, LAM
USER, test, *, EMEA
but the above section access code working on only one row and not giving the expected results?
Please advice on above
* should represent all listed values on section access table not all values possible
You need to associate the field in section access to the source data.
Please refer here and see if it helps
Identify the lowest level of data and associate the field to section access script in QlikSense.
There is no option in QlikSense to enable/disable security.
Also another note, section access will work only in enterprise version and not in desktop.
See below script for reference
LET vHierarchyDef='Country,State,City';
LET vLevels=Len(KeepChar(vHierarchyDef,',')) + 1;
Section Access;
LOAD * INLINE [
ACCESS, USERID, REDUCTION
ADMIN, US\SATISHKURRA,
USER, US\SALIDINA, ILLINOIS
USER, US\SREEDENON, TEXAS
USER, SK, CHICAGO
];
Section Application;
For vAncLevels= 1 to vLevels
LET vAnc=SubField(vHierarchyDef,',',vAncLevels);
Trees:
LOAD Distinct
UPPER([$(vAnc)]) as REDUCTION,
[EmployeeGroup]
Resident Link;
Next vAncLevels
Notes from above script
1. This script will reduce the data based on hierarchy level (Country, State and City). If your data do not have hierarchy, specify the column name in vHierarchyDef variable (For example if you want to reduce data only to Country level, only specify Country
2. For ADMIN, REDUCTION column is empty, means access to all data
3. SALIDIN is able to see only data for ILLINOIS state
4. SK is able to see only data for Chicago city
Another important note, if by any chance your load failed, you can still enter into the script by right clicking the app in work folder (hub) and click open without data and perform changes.
If you face any difficulty, please let us know
Thanks
Satish
Note: Link provided by Carlos is a good starting point to implement security in QS
Good luck!
ALso refer this
These are good articles about Section Access in Qlik Sense:
Making Sense of Section Access in Qlik Sense
Tips and tricks for section access in Qlik Sense (2.0+)
You can also use custom rules for controlling access to Streams, Apps, Sheets and App Objects:
HI Satish
Thank you so much for your reply
As per the code you mentioned, It is working for the hierarchy
USER, US\SALIDINA, ILLINOIS
what if Salinda also want to see the data of losangeles from a different state which is California and also want to see the data of the State 'Indiana'??
How this can be possible??
LET vHierarchyDef='REGION,COUNTRY';
LET vLevels=Len(KeepChar(vHierarchyDef,',')) + 1;
sECTION ACCESS;
SA:
LOAD * inline [
ACCESS, USERID,REDUCTION
ADMIN, TEST,MEX
ADMIN, TEST,ASP
];
SECTION Application;
For vAncLevels= 1 to vLevels
LET vAnc=SubField(vHierarchyDef,',',vAncLevels);
data:
D2:
Load REGION,COUNTRY,VALUES,UPPER([$(vAnc)]) as REDUCTION
Resident D1;
Here Admin can only view Region level data where as ASP but not the country Mexico
Please help on this??