Monday 17 October 2011

SSRS : Passing Parameters to a Report and control Its Display using 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.


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.



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

No comments:

Post a Comment