all groups > sql server reporting services > august 2005 >
You're in the

sql server reporting services

group:

UserID doesnt really work


UserID doesnt really work Marvin
8/26/2005 5:19:02 PM
sql server reporting services: I use the User.UserID to populate a parameter. When calling the report the
first time a list of parameters are prompted, at this time the field that
uses user.userID is disabled. However after filling the parameters and
submitting the request the field that uses user.useriD is now enabled for a
RE: UserID doesnt really work EsWallace
8/29/2005 1:51:50 PM
Here is What I did

Reporting Services has the ability to pull in the Current User ID of the
person that is viewing the Report. You can create a hidden parameter and use
that parameter in the Dataset.
After you have built your Report
ï‚§ Create your user Parameter. Name it USER.
ï‚§ Keep the Prompt Blank. By doing this it will prevent the Parameter from
viewing in the parameter box.
ï‚§ Leave the Available values as Non-queried and the values blank.
ï‚§ Make the Default value as Non-queried
ï‚§ Input the Default formula as: [= REPLACE(User!UserID,"[domain]\","")]
ï‚§ Create you Dataset
ï‚§ Here is an Example Query used in a Dataset

SELECT CASE WHEN EmpPreferredFirstName =''
THEN RTRIM(EmpFirstName)
ELSE RTRIM(EmpPreferredFirstName)
END + ' ' + EMPLASTNAME AS NAMES
FROM [Server].[Database].DBO.EMPLOYEE
WHERE NETWORKUSERID = @USER


[quoted text, click to view]
RE: UserID doesnt really work Marvin
8/29/2005 3:05:01 PM
thank you, i'll try that. But looks like its going to work. But one question.
If i have a field that by default gets the data from user.userID, should a
user still be able to enter their own value. Shouldn't it always get its
value from that global variable no matter what a user inputs?

[quoted text, click to view]
Re: UserID doesnt really work Bruce L-C [MVP]
8/29/2005 8:42:18 PM
I question whether you need to use a parameter. The query parameter can be
mapped directly to the userid without a parameter. For your dataset click on
the ..., go to the query parameter. On the right side select expression. In
the expression you can use the expression builder or you can just use same
formula suggested for the default:
= REPLACE(User!UserID,"[domain]\","")

The problem with the parameter method is someone could create the URL by
hand and substitute in a different user. Being hidden they won't see it in
Report Manager but you can still fill it in via the URL.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: UserID doesnt really work Marvin
8/30/2005 4:27:02 PM
thank you for that. a lot better solution

[quoted text, click to view]
AddThis Social Bookmark Button