Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In my application, I have a straight table that has a column called "Client Name". I want to have what is displayed in this field to be based on the user. If a users belongs to an "Administrator" group, I want the data as shown in the model to display. Otherwise, I want to display a dash. I have loaded a table into the model with the Users (which would match the results of OSUser() ) and a flag field for Admin/Not Admin. I just cannot determine the correct formula to use to make the connection... something like an Excel VLookup(). Any ideas?
I was actually able to solve my problem using set analysis. My resulting expression looks like this:
=if(Sum({$<SecNTName_UC={$(=UPPER(OSUser()))}>}SecShowClient) = 1, ClientName, if(Sum({$<SecNTName_UC={$(=UPPER(OSUser()))}>} SecBranchID)= BranchID, ClientName,'-'))
The fields in the User table look like this:
SecNTName_UC | SecShowClient | SecBranchID |
---|---|---|
DOMAIN\USER1 | 1 | 0 |
DOMAIN\USER2 | 1 | 0 |
DOMAIN\USER3 | 0 | 1234 |
DOMAIN\USER4 | 0 | 2345 |
The nested IF is saying if the sum of the "SecShowClient" field (limited by the OSUser() ) is 1 then show the ClientName; otherwise only show the ClientName field when the "SecBranchID" matches the one assigned to the OSUser()
A more secure option would be to look at Section Access with Data Reduction, as this will remove data that the user is not permitted to view rather than just hiding it.
Have a look here for more details on Section Access. Introduction to Section Access
it would be good, if you can share an sample app and what output your expecting?
Thanks Colin. In this case we don't want to reduce the data. We still want all users to see components of the data, but one particular field we want to suppress the details.
I was actually able to solve my problem using set analysis. My resulting expression looks like this:
=if(Sum({$<SecNTName_UC={$(=UPPER(OSUser()))}>}SecShowClient) = 1, ClientName, if(Sum({$<SecNTName_UC={$(=UPPER(OSUser()))}>} SecBranchID)= BranchID, ClientName,'-'))
The fields in the User table look like this:
SecNTName_UC | SecShowClient | SecBranchID |
---|---|---|
DOMAIN\USER1 | 1 | 0 |
DOMAIN\USER2 | 1 | 0 |
DOMAIN\USER3 | 0 | 1234 |
DOMAIN\USER4 | 0 | 2345 |
The nested IF is saying if the sum of the "SecShowClient" field (limited by the OSUser() ) is 1 then show the ClientName; otherwise only show the ClientName field when the "SecBranchID" matches the one assigned to the OSUser()
Hey, this is amazing, but I am having a rough time here... I'm trying to do something very similar to what you wanted except i have a table of users that have access. I'm trying to set it so that they have access to what they need without access to what they can't have. We've got the qlik usernames stored in a table, so i just need to compare the username in the table with the username logged in to the access level.
my fields are qlikuser (from the db), subfield(osuser(),'=',-1) (logged in user), and planid
my current analysis is: =if(count({Qlikuser={$(upper(subfield(osuser(),'=',-1)))}>}PlanID)>0,PlanID)
example data would be
table:
user1 planA
user1 planB
user2 planB
user1 logon:
data data data planA
data data data planB
user2 logon
data data data
data data data planB
Do you think this would conform?
Thanks ❤️
ok, for anyone else, this is the current addition to this other person's wonderful start:
=if(count({$<QlikUser={$(=upper(subfield(osuser(),'=',-1)))}>}PlanID)>0, PlanID, NULL())
I think this is going to work for what i need! - will let you know!