SSRS: Passing parameters to a report and control its display using a URL
We can use SSRS Reports to be displayed as images directly in our own web page and we can also perform an export without even displaying the report or embed the report in our own Custom UI. This is possible by altering the URL for the Report. We can use the ‘rc:’ and ‘rs:’ parameters of SSRS.
These parameters help us to customize the way the reports are rendered.
rc:
This parameter prefix means Report Client Command. It is used to alter the way the report is rendered. The most useful parameters included in this are:
1) Parameters
· It shows or hides the parameters area of the toolbar. It take the values as True, False or Collapsed.
· True Means that the Parameters section is displayed. It is the default Value.
· False Means that the Parameters section is displayed and the user cannot toggle it to be displayed.
· Collapsed Means that the parameters are hidden but can be toggled by the user.
http://2.bp.blogspot.com/-BSMmDcw7aIA/TpwW3Ez7JRI/AAAAAAAAAKI/Kdp7HD0iV5Q/s320/image004-716375.jpg
2) Toolbar
· It shows or hides the toolbar. It takes the values as either True or False.
· True means that the toolbar is displayed. It is the default Value.
· False means that the toolbar is displayed.
http://4.bp.blogspot.com/-L28CJoRnz1k/TpwW3N5FAdI/AAAAAAAAAKQ/8G6axg3B-Ks/s320/image008-716851.jpg
3) Section
· It specifies the page number of the report to be displayed.
· The default value is 1.
· If its value is less than 1 then page no 1 is displayed.
· If its value is greater than total pages in report then the last page is displayed.
4) Stylesheet
· It specifies the CSS that has to be applied to the viewer
5) Zoom
· It specified the zooming factor for the report
rs:
This parameter prefix means Report Server Command. It is used to alter the way the report is executed. The most useful parameters included in this are:
1) Format
· It specifies the format in which the report has to be exported.
· The report is not rendered instead it is given as a downloadable file in the requested format.
· The valid formats are :
o HTML3.2
o HTML4.0
o MHTML
o IMAGE
o EXCEL
o WORD
o CSV
o PDF
o XML
2) Command
· It specifies the action to apply to the path, such as render a report or list all of the items in a folder. Defaults to Render for reports.
· It takes the following values
o Render (Default)
o ListChildren
o GetResourceContents
o GetDataSourceContents
3) Snapshot
· It specifies the snapshot of the report to be rendered
If the report has parameters, these parameters can be passed by specifying the parameters in the URL as
*‘&ParameterName=ParameterValue’
*
Note *
The Multivalued parameters are passed as comma separated values.
The Date type parameters must be passed as MM/dd/yyyy
If the rc: parameters is set to false then the parameters values must be passed in the URL or the default values must be specified else it will throw an exception
Example
http://3.bp.blogspot.com/-KYzrDD7xgak/TpwW3UNjGGI/AAAAAAAAAKk/arylUWY3C0Y/s320/image009-717301.jpg