SQLTeam.com | Weblogs | Forums

SSRS - hide rows based on the user who run the report

sql2014

#1

Hi
I would like some help in writing an expression to hide the rows based on the users who run the report.
I have a Users SQL table and in that table there are around 10 users in a group named 'Client Employees' with Group ID value 100.
I have a requirement that - the report should display all the rows if the user who is running is in the above named group Client Employees. and
the report should hide the rows if the user who is running the report is not in that group Client Employees.

I have just tried the below with one user and it seems to be working (when i ran the report i could not see that record and when user ABC ran the report ABC can view that record), but i am not sure how can i code it for all the employees in that group (and also there many be new users getting added to this group)

=IIF(Fields!GROUP_ID.Value = 100 and RIGHT(User!UserID,3) <> "ABC", True,False)

Any ideas?

Thanks,
grkanth81


#2

This might help

http://www.sqlservercentral.com/blogs/sqldownsouth/2016/02/08/sql-server-2016-row-level-security-and-ssrs-a-perfect-match/


#3

use a stored procedure that takes a parameter of @userid.
then manipulate data to be displayed by filtering ising this @userid.
ssrs provides userid out of the box


#4

Thanks ahmeds08.

But we are using SQL SERVER 2014.

Thanks,
grkanth81