Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 SSRS 2008 User!UserID

Author  Topic 

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2013-10-04 : 12:05:32
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?

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-10-04 : 12:19:59
UserId is a built-in field in SSRS. If you look in the Expression editor window, you will see that listed under built in fields. At runtime, it will get populated with the userid that is running the report.

I am not familiar with the right(User!UserID,10) in the context of an RDL file, but I would guess that it is taking the rightmost 10 characters of the username. If you are using the Windows Authentication, the UserId is of the form Domain\Username. So perhaps, they are trying to just get the rightmost 10 characters to get the Username?
Go to Top of Page

jassie
Constraint Violating Yak Guru

332 Posts

Posted - 2013-10-04 : 17:53:55
Thanks!
Go to Top of Page
   

- Advertisement -