Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello community,
I want to restrict the data visible, not just remove the values or distribute the data already restricted for users through publisher or nprinting.
Each user has a target. There is a target for every year:
The users have restircted rights depending on their OSUser() (I am Tom in this case):
I can only see my data currently:
Since I am admin, I want to see the data of everybody. I am not able to achieve this. I tried mainly set analysis.
sum(if(only( {$ < OSUser = {'$(=OSUser())'}> } Admin_Flag ) = 'true', Target))
You can find every a prepared example in the attachment. Thansk for any help. I am open to different approaches.
Best
Philipp
So I managed to get the result through conditional Expressions. Thanks everyone!
Hi.
Why don't you use section access ?
Anyway I think it's better to add 'Role' entity and then connect the users with the roles. So you get more flexibility and can use the same expressions for both admins and users.
Usually it's better to use set analysis for that like this: Sum({<OSUser={'$(=OSUser())'}>} Target)
You also have to restrict server objects creation, otherwise the users can simply change the expression.
I tried with this expression:
sum(if(OSUser = OSUser() or Admin_Flag = 'true', Target))
It just shows current user data and admins data.
Use a different expression for user or admin like this:
if(Concat({<OSUser={'$(=OSUser())'}>} Admin_Flag) = 'true',
Sum(Target),
Sum({<OSUser={'$(=OSUser())'}>} Target)
)
I tried the same:
if(match(minstring({<OSUser={'$(=OSUser())'}>} Admin_Flag), 'true'),
sum(Target),
sum({<OSUser={'$(=OSUser())'}>} Target)
)
but it delivers just the user.
It is unwanted here because it is just one simple value in the hole application.
So I managed to get the result through conditional Expressions. Thanks everyone!