Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
chiranjivdas
Contributor III
Contributor III

Is there a way to show/hide a Dimension based on log on IDs?

I want to restrict a group of users from being able to see a column/dimension on a pivot table. The users can be identified with their logon ids. Can a condition using "Show(if...)" type of script be created to facilitate this?

1 Solution

Accepted Solutions
Gysbert_Wassenaar

There are two ways (at least). Section access is one way. That's probably the better option, but maybe a bit more work to set up. See here for an introduction pdf.

Or you can use the OSuser() function in the conditional expression of the dimension.

if(OSUser() = 'MyDomain\MyUser',1,0) will show the dimension only if the user is named MyUser and part of MyDomain.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

There are two ways (at least). Section access is one way. That's probably the better option, but maybe a bit more work to set up. See here for an introduction pdf.

Or you can use the OSuser() function in the conditional expression of the dimension.

if(OSUser() = 'MyDomain\MyUser',1,0) will show the dimension only if the user is named MyUser and part of MyDomain.


talk is cheap, supply exceeds demand
chiranjivdas
Contributor III
Contributor III
Author

Thanks, Gysbert. It works. But the requirement has somewhat changed for me.

Now I want to restrict not by MyUser but by MyDomain. So let's say that anyone who has the domain "MyDomain" should be able to see it and anyone who does not should not be able to see it. It should no longer be driven by username but by domain name.

MayilVahanan

HI

Lets try like this

vVariable = 'YourDomainName'

If(vVariable = SubField(OSUser(),'\'),1,0)

For example, vVariable = 'XXXX' <-Your domain name

SubField(OSUser(),'\') giives XXXX

so its display based on that

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
chiranjivdas
Contributor III
Contributor III
Author

Thanks. I tweaked it a bit:

(left(OSUser(),3) = 'xxx',1,0)

MayilVahanan

Hi

you can use left() function when u know the len of domain..suppose if domain size  greater than 3 means ..then its not use ...give preference to subfield() function..

And if u get ur requirement means pls close this link by mark as assumed answer or correct answer..

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.