SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 SSRS 2008 User!UserID
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jassie
Constraint Violating Yak Guru

291 Posts

Posted - 10/04/2013 :  12:05:32  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3559 Posts

Posted - 10/04/2013 :  12:19:59  Show Profile  Reply with Quote
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

291 Posts

Posted - 10/04/2013 :  17:53:55  Show Profile  Reply with Quote
Thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000