Avatar of Karl_mark

asked on 

SSRS Pass UserId!UserId as Parameter to Data Set

Evening All! The following is on SSRS 2008.
I have a report set up which currently works by pulling the GUID of a User from our HR application and passes this as a parameter to an SSRS Report. It all works well and the report filters correctly.
However, it is obviously better to not pass the GUID as a parameter (even though the chances of a user figuring out someone else's GUID is minimal) and also using this method requires using a new window in the launching app to pull through the value; pulling the UserId in the report would enable me to place the report link on the main dashboard.

I've read around on Google and clearly the solution is to pass UserId!UserId as the parameter to  the Data sets. The data sets are Stored Procedures which will accept the UserId as a parameter. I've added a Parameter to the report called @UserId and set the default value as =UserId!UserId. The parameter in the data set is set as @UserId. I can't see anything wrong there!

At this point it's worth mentioning that the UserId itself is actually the person's employee number; we have custom authentication so there are no issues with domain names etc. getting in the way. I have tested this by running a report without the paramter but having UserId displayed in a text box and it returns the expected value.

The problem is that when I call the report from our web application I see the following error:

Microsoft.ReportingServices.Diagnostics.Utilities.UnknownReportParameterException: An attempt was made to set a report parameter 'UserID' that is not defined in this report.;

I'm not sure why I am seeing this error. The parameter in the stored procedures is called @GlobalID, but surely that can't be the cause can it? (I can't currently change it anyway as the data source is a database snapshot and for some reason the snapshot update job doesn't seem to be working - have to wait until the dba comes in tomorrow). Is there any other reason why I would get this message?

Avatar of undefined
Last Comment
Avatar of sachiek
Flag of Singapore image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Karl_mark


Thanks Sachiek. It is now loading (or trying) to load the report at least!
The problem I'm having is that it doesn't seem to be applying the parameter (if I'm understanding the error correctly). I'm getting an error loading a dataset because of a "divide by zero error".
So, it is accepting UserID as a parameter (it would seem), but not generating any results as this is the same error I would get on the report server if I put in a non-existent UserID.
Is there any way of tracing what parameters are being applied to a report at runtime? The stack trace only tells me the data set name and the error message.
Avatar of Karl_mark


The parameter is now being accepted....

SQL Server Reporting Services (SSRS) is a server-based report generation software system from Microsoft. It can prepare and deliver a variety of interactive and printed reports and is administered via a web interface or its web service. Its web services interface also supports the development of custom reporting applications. Finally, SSRS can also be integrated with SharePoint. SSRS competes with other business intelligence tools, most prominently Crystal Reports.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo