Link to home
Create AccountLog in
Avatar of shobhitdixit
shobhitdixit

asked on

Working with session in Reporting services

I am working in reporting services SSRS 2005. I am trying to figure out a way of using session
(I know that a specific session is created by reporting server when a new user views report). What is the best way to show the user his session. Say a particular user abc is logged in: what is the conventional way to show the user his ID and session.

Please suggest on this!
ASKER CERTIFIED SOLUTION
Avatar of Christopher Gordon
Christopher Gordon
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of shobhitdixit
shobhitdixit

ASKER

Is there a way going beyond this; say defining a name using the User ID, if no, then i will bounce back with a specific question in a new thread.

Thanks
Yes, but it would take some work.  You would need to create a table in your SQL Server database that has two columns, one for userId and one for userDescription.  You would also need to know the userIDs of individuals using the report.

UserID would be the value returned by UserID in SSRS. (you'll be passing it as an input parameter)
UserDescription would be the value you'd like to display.

Create a stored procedure that accepts userId as an input parameter and returns the corresponding User description as the return set.

something like
create proc GetUserName(@userId as varchar(30))
--note userID passed from SSRS later
as

begin
select userDescription
from reportUsers
where userId = @userId
end

Next, within SSRS, create a new DataSet on your report called, dsDescriptiveID.

set the command type to stored procedure
set the query string to the name of the stored procedure you created
select the parameters tab on the dataset screen
enter the name of the parameter in the name column (@userID if that is what you used in your sproc)
select the dropdownlist in the Value column
select <expression....>
similar steps before...
go to globals
select userid
HIt "OK"

You now have a dataset that should return the description in SQL Server you can use this on the report.

Go to the textbox you were using before to display userID.
Expression...
Select DataSet instead of Globals
Select dsDescriptiveID (or whatever you named it)
Select first(userDescription)


Good luck
Thanks! i will keep this in mind
Avatar of Chris McGuigan
If by session, you mean the session id, I'm pretty sure you can't refer to this in RS unless you write some external code.

Cheers
Chris