BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Pcp
Fluorite | Level 6 Pcp
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Renato_sas
SAS Employee

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):

 

Figure 1-Open Report.PNG

 

After she clicks on the top button, her name is selected according to the dsplay rule:

 

Figure 2-Click on Button.PNG

 

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:

 

Figure 3-Button Bar Roles Assignment.PNG

 

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:

 

Figure 4-Flag for Rule.PNG

 

Then the display rule (I've chosen to highlight the entire row):

 

Figure 5-Display Rule.PNG

 

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.

 

Figure 6-Permission Condition.PNG

 

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:

 

Figure 7-External Identity.PNG

 

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

View solution in original post

4 REPLIES 4
Renato_sas
SAS Employee

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):

 

Figure 1-Open Report.PNG

 

After she clicks on the top button, her name is selected according to the dsplay rule:

 

Figure 2-Click on Button.PNG

 

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:

 

Figure 3-Button Bar Roles Assignment.PNG

 

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:

 

Figure 4-Flag for Rule.PNG

 

Then the display rule (I've chosen to highlight the entire row):

 

Figure 5-Display Rule.PNG

 

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.

 

Figure 6-Permission Condition.PNG

 

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:

 

Figure 7-External Identity.PNG

 

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

Pcp
Fluorite | Level 6 Pcp
Fluorite | Level 6

Hi Renato,

 

It worked for me by adding button bar.

 

Thanks alot,

PCP

rufmau68
Obsidian | Level 7

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

 

rufmau68
Obsidian | Level 7

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 4 replies
  • 2269 views
  • 3 likes
  • 3 in conversation