Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSRS 2008 User!UserID Expand / Collapse
Author
Message
Posted Friday, October 4, 2013 10:04 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, September 25, 2014 11:17 AM
Points: 377, Visits: 446
In a SSRS 2008 report, I see some sql that is accessing User!UserID as a hidden parameter that is supplied to the SSRS report as displayed in the
XML listed below:
<ReportParameter Name="User">
<DataType>String</DataType>
<DefaultValue>
<Values>
<Value>= right(User!UserID,10)</Value>
</Values>
</DefaultValue>
<Prompt>User</Prompt>
<Hidden>true</Hidden>
<ValidValues>
<ParameterValues>
<ParameterValue>
<Value>= right(User!UserID,10)</Value>
<Label>User</Label>
</ParameterValue>
</ValidValues>
</ReportParameter>

This value is not coming from any sql that is run in the SSRS report. I am assuming this is some kind of a feature in SSRS 2008, correct?

Thus can you explain to me where the value for the User!UserID is coming from? In addition, would you tell me what the
"right(User!UserID,10)" statement is actually doing?
Post #1501663
Posted Monday, October 7, 2013 9:26 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Yesterday @ 7:40 PM
Points: 3,062, Visits: 2,673
User!UserID is a standard fields available within a report. Reporting services gets the value from Windows. It contains the windows/AD user name of the user who is running the report. So, if you domain name is "mycompany" and you login as user "myuser" then the value of User!UserID will be "mycompany\myuser"

right(User!UserID,10)" gives you that last 10 characters of the variable User!UserID. In my example, this would be "any\myuser". I suspect that you company has user names that are 10 characters long and the "RIGHT" function for you would be returning the person's user name



Post #1502458
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse