2/17/2011

Limit Report Results Based on User Logon

Sometimes there's a need to add security to your SSRS report.  You can limit what values your users can see by adding a new parameter and modifying your "where" clause to equal the user - that way they can only see what they have rights to:

Create a parameter called User 
     (String)
     (Hidden)
     (Non-Queried)
     with a Default Value:  

=Right(User!UserID, Len(User!UserID)-InStr(User!UserID,"\"))

And in your DataSet add Parameter:
     Name: @User
     Value: =Parameters!User.Value

Add a WHERE Clause to your Dataset:
     WHERE n.LoginID=@User

Should be good to go!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.