Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
gsethuraman21
Contributor
Contributor

Regarding Section Access ,i need to get the user ID who is login to Qlik sense application

Section Access;
LOAD * Inline
[ACCESS,USERID,PERSON_IDENTIFIER,REPORTS_TO
ADMIN,TAG\T234GC,432555,63225
ADMIN,TAG\T564GS,1761528,432555
ADMIN,TAG\T0386HC,932143,63225
ADMIN,INTERNAL\SA_SCHEDULER,13212];

I need to get who is login to the Qlik sense Application so i can get that variable value i and parse to subsequent queries to generate the Charts ..

Section Application;

// LET vSA1 = UPPER(peek('PERSON_IDENTIFIER',0,'SECTION_ACCESS_FIELDNAME'));

LET vSA1 = UPPER(peek('PERSON_IDENTIFIER'));   //(But by default iam getting 13212 sa scheduler value )

 

For example if  this person logs in TAG\T234GC , i need 432555 in variable (vSA1 =432555)

 

For example  if this logs in TAG\T564GS,i need  in  1761528 (vSA1 =1761528)

4 Replies
Vegar
MVP
MVP

You can not set the vSA1 variable during the script execution as the data reduction is performed as the user opens the application.

I assume you have a field in your application called PERSON_IDENTIFIER and that each USERID is only connected to one PERSON_IDENTIFIER in the Section access table. Then you could during the script execution declare the vSA1 as this.

SET vSA1 = Only(PERSON_IDENTIFIER)

Right after an reload your variable will return NULL as you have more than one PERSON_IDENTIFIER, but when the data is reduced by an user opening the application the variable will have the right single value.

gsethuraman21
Contributor
Contributor
Author

So in that scenario how i parse person identifier in section application queries ..

for example how to get below value in the where clause ..

WHERE ROOT.REPORTS_TO_USER = $(vSA1)  and TJOBAT.AUTHORIZED_PERSON In $(vSA1) 

 

Becuase  --> SET vSA1 = Only(PERSON_IDENTIFIER); --> returns as string field -> Only(PERSON_IDENTIFIER) ..

Vegar
MVP
MVP

You can not use user specific queries in the script, because the script is executed and run before any user access the application. You should load the application with all data and let the Section Access do the reduction when the user opens the application.

When the user TAG\T0386HC opens the application with your above mentioned SA table it will only see the data for data associated with the field PERSONAL_ID = 932143 and REPORTS_TO = 63225.

If you think I missunderstood your last comment then please add some sample script on how your where thinking and a pic of your datamodel to help us understand your issue better.

gsethuraman21
Contributor
Contributor
Author

Thanks for the reply