Geeks With Blogs

News

DevJef's Mumbo-Jumbo «There's a bit of SQL in all of us»

A colleague asked me if it’s possible to set the parameters of a Report in the URL, so that he could send it to an end-user. I didn’t know the answer, and after some research I came to the conclusion that it’s possible.

 

Just like your used to, you pass parameters into the Report by modifying the URL. An example of a normal Report URL looks like this:

http://<ServerName>/Reports

 

In order to use parameters in the URL, you need to use the Service URL. The Service URL has the possibility to add specific options into the URL, so that SSRS knows what to execute. The changed URL looks like this:

See Reports directory:

http://<ServerName>/ReportServer

List Reports in SSRS directory:

http://<ServerName>/ReportServer?%2fArea+51&rs:Command=ListChildren

 

As you can see, the SSRS contains a folder called “Area 51”, and a subfolder “Finance”. This folder contains the Report “CustomerReport”, which we want to use to pass parameters.

 

Parameters in an URL are added as followed:

Just a CustomerID:

http://<ServerName>/ReportServer/Pages/ReportViewer.aspx?%2fArea+51%2fFinance%2fCustomerReport&CustomerID=1&rs:Command=Render

And CustomerID and PaymentDate:

http://<ServerName>/ReportServer/Pages/ReportViewer.aspx?%2fArea+51%2fFinance%2fCustomerReport&CustomerID=1&PaymentDate=2011-09-23&rs:Command=Render

 

The “rs:” parameter tells the SSRS what to do with the URL. “ListChildren” will create an open-dir look and feel, and “Command=Render” will actually execute and render the Report.

 

There are a lot more properties that you can use to modify the URL, and give the end-user a Report with specific data, without storing default values in the Report itself.

 

Sources:

MSDN

Posted on Friday, September 23, 2011 3:05 PM SSRS | Back to top


Comments on this post: Parameters in Report URL

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © DevJef | Powered by: GeeksWithBlogs.net