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: 
J_Post
Contributor II
Contributor II

Set Expression using UserID

I am trying to extract a single value from my table based on the active user of the app. The value I am pulling out is an access code that will limit which sheets in the application the user can see. 

I am currently using 

=Text(SubField(OsUser(),'=',-1))

to get the active user of the sheet. This is set into the variable 'ActiveUser' in the Data Load Editor. 

 

The data I have imported has this UserID, called 'QSIdPSubject' (I didn't name it) and an [AccessLevel] which is a simple number.

I am trying to use 

=only(  {1< [QSIdPSubject] ={'$(=$(ActiveUser))'}>} [AccessLevel]) 

as a variable expression to get the Access Level integer. The Access Level will then be used in the show conditions of each sheet. 

I am getting no results from the set expression even though I have manually confirmed the two IDs are identical and Qlik is showing no errors in the formula. 

What am I doing wrong? 

Labels (2)
1 Solution

Accepted Solutions
J_Post
Contributor II
Contributor II
Author

For anyone else looking at this for a similar problem. I found the solution. I was overcomplicating the set expression. It only needs to be.

=only({1<QSIdPSubject={"$(vActiveUser)"}>} AccessLevel)

 

Just was using to many parentheses and such. Hope this helps.

 

View solution in original post

3 Replies
anthonyj
Creator III
Creator III

Hi @J_Post ,

First thing that I see is that you're using single quotes around the dollar expansion. This is for a string so if you want to resolve the dollar expansion you have to use double quotes.

=only(  {1< [QSIdPSubject] ={"$(=$(ActiveUser))"}>} [AccessLevel]) 

Give that a try

Thanks

Anthony

J_Post
Contributor II
Contributor II
Author

Hi Anthony, 

This got me a little closer. Instead of showing null I get 0 out of the expression which is definitely a step in the right direction. 

Could there be an issue with empty space or format? There is visually no difference in the QSIdPSubject and the ActiveUser, but I am still not getting a value returned. 

 

Thanks 

J_Post
Contributor II
Contributor II
Author

For anyone else looking at this for a similar problem. I found the solution. I was overcomplicating the set expression. It only needs to be.

=only({1<QSIdPSubject={"$(vActiveUser)"}>} AccessLevel)

 

Just was using to many parentheses and such. Hope this helps.