Hi All,
Is there any way to apply display rule on basis of current user id ?
I want to only highlight (change background color of) a row having current user in a list table. Is there any way to use SAS:SUB::UserID
in display rule for comparison ? or can we do this by using STP ?
Any help will be appreciated.
Thanks for your time,
PCP.
Hi PCP,
If you are ok with the user having to click on a button with his/her name to highlight the line containing the name, then this may work for you.
Here is an example of report just opened by user Christine Fletcher (note that her name is on the top, and if another user had open this same report, the other user's name would have been displayed instead):
After she clicks on the top button, her name is selected according to the dsplay rule:
This is how it works:
I've used two source tables in this example. One source table (EMPLOYEE) contains the list of employees that I used to populate the button bar at the top. The other source table contains the data to be displayed in the list table object.
For the button bar, I've also assigned a character parameter that I've called LoggedUser:
Because display rules depend on numeric values only, I've created a calculated column based on the column Employee Name found in the second table. I've called that new column Flag for Rule, that looks like this:
Then the display rule (I've chosen to highlight the entire row):
Now, to guarantee that the top button bar contains only the name of the user logged in, I had to apply row level security to the EMPLOYEE table. The conditional grant was applied to the Read permission for the SASUSERS group and looked like below. Note that for this to work the user's metadata identity name must match with the value stored in the Employee_Name column. You can use other functions in the exression if needed, such as upcase(), trim(), etc.
If you really want to use their ID's instead of their names, then you could do so by storing their ID's as metadata External Indentities in SAS Management Console:
The permission condition expression would then be something like this (Employee_ID is the column from your table):
SUB::SAS.ExternalIdentity = Employee_ID
I hope it helps.
Best,
Renato
Hi PCP,
If you are ok with the user having to click on a button with his/her name to highlight the line containing the name, then this may work for you.
Here is an example of report just opened by user Christine Fletcher (note that her name is on the top, and if another user had open this same report, the other user's name would have been displayed instead):
After she clicks on the top button, her name is selected according to the dsplay rule:
This is how it works:
I've used two source tables in this example. One source table (EMPLOYEE) contains the list of employees that I used to populate the button bar at the top. The other source table contains the data to be displayed in the list table object.
For the button bar, I've also assigned a character parameter that I've called LoggedUser:
Because display rules depend on numeric values only, I've created a calculated column based on the column Employee Name found in the second table. I've called that new column Flag for Rule, that looks like this:
Then the display rule (I've chosen to highlight the entire row):
Now, to guarantee that the top button bar contains only the name of the user logged in, I had to apply row level security to the EMPLOYEE table. The conditional grant was applied to the Read permission for the SASUSERS group and looked like below. Note that for this to work the user's metadata identity name must match with the value stored in the Employee_Name column. You can use other functions in the exression if needed, such as upcase(), trim(), etc.
If you really want to use their ID's instead of their names, then you could do so by storing their ID's as metadata External Indentities in SAS Management Console:
The permission condition expression would then be something like this (Employee_ID is the column from your table):
SUB::SAS.ExternalIdentity = Employee_ID
I hope it helps.
Best,
Renato
Hi Renato,
It worked for me by adding button bar.
Thanks alot,
PCP
Hi Renato,
but if PCP have a bored user that dont' wont to click on the bottom...
it's not possible to have the value directly in any calculated element
or
parameter
or interaction
?
thks
bye
Mauro
a great idea PCP!
but it's not so good that the user when open the report
need to click on the bottom
it's not possible that the value is auto saved in a parameter and than to use the parameter in any visual rule or in any calculated elements ?
thks
mauro
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.