all groups > sql server reporting services > january 2007 >
You're in the

sql server reporting services

group:

Use login name as parameter?


Re: Use login name as parameter? Bruce L-C [MVP]
1/2/2007 11:00:25 AM
sql server reporting services:
Two points you need to know. First, a query parameter does not need to be
mapped to a report parameter. People get used to thinking these are the same
thing but they are not. RS automatically creates report parameters for you.
In the dataset tab click on the ... and then go to the parameters tab to see
where the mapping occurs. The query parameter can map to an expression. The
expression can use the global variable User!UserID. Note that this returns
the domain name as well as the user name of the person running the report so
if you want just the user name you will need to strip off the domain name.
Try a report and put a textbox at the top, set it to an expression and using
the expression builder select this global variable. Then run the report so
you can see what is returned.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Re: Use login name as parameter? Bruce L-C [MVP]
1/2/2007 2:15:11 PM
One caveat. You will not be able to run the report as a subscription. The
reason is, there is no user that is running the report. So if you need a
subscription then you will need a version of the report that does not use
the User!UserID global variable.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Use login name as parameter? ana9 via SQLMonster.com
1/2/2007 3:54:27 PM
My users are logging into a secure database with their own usernames/pwd's.
I want the individual users to only be able to see their own information and
not the entire report. Is there any way to grab their username and put it in
a parameter?

I really don't want to create a separate report for each person...

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200701/1
Re: Use login name as parameter? ana9 via SQLMonster.com
1/2/2007 8:07:13 PM
Cool trick, thanks.

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200701/1
Re: Use login name as parameter? SmartbizAustralia
1/4/2007 2:23:48 AM
A very common situation and easily addressed.

Noting the userid parameter is based on their login - the windows
one....

What I do is use a function that filters out the domain name in etc and
brings back just the userid which is in turn passed to the query which
uses this to filter the records.

These reports cannot be subscribed to because they need a set user..

The data connection I use is a sql server user (database logon only)
with only read rights and the rights to execute the stored procedures
required.

Regards,
Tom Bizannes
Sydney, Australia
Re: Use login name as parameter? ana9 via SQLMonster.com
1/4/2007 2:51:39 PM
Thanks for the userid clarification. I am putting these reports on
Sharepoint and wasn't sure if the global UserID would refer to the Sharepoint
login or the Windows login. I am not filtering out the domain name, I am
simply adding the domain name to the stored userid and then comparing them.
It just seemed easier.

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-reporting/200701/1
AddThis Social Bookmark Button