Dela via


Running a Parameterized Report

A parameterized report is a report that uses input values to complete report processing. Familiar examples of parameterized reports include those that filter by a regional value, a product category, or an identifier. Parameters are typically used to complete a query that selects data for the report. If you manage or run a parameterized report, you need to understand how parameter selections affect the report you are working with.

Note

A report author defines the parameters used in a report. After the report is published, you can modify some parameter properties to change which values are used and how the values are obtained. For more information about creating parameters, see Parameters (Report Builder 3.0 and SSRS). For more information about managing parameters, see Setting Parameter Properties for a Published Report.

Storing and Prompting for Parameter Values

To get a parameter value at run time, you can store a default value with the report or prompt the user to type or select a value. Storing a parameter value with a report is useful if you want the report to always process with a specific value. For example, if a regional office has a dedicated Web site, you can host a regional sales report on the Web site that always uses a specific region code.

You can also prompt users to type or select the value to use when they open the report. When you configure a report to prompt for parameter values, input fields are provided so that the user can type specific values. After typing the values, a user clicks View Report to run the report. If the values are valid, the report appears. If the values are not valid, you will either get an error message or an empty report. If you use stored parameter values, the report opens without displaying input fields or the View Report button. All users who run the report use the same parameter value.

If the report includes query-based parameters, and the data source requires each user to log on, the user will be prompted for credentials before the parameter input fields are displayed on the page. In this case, the credentials must be provided in order to retrieve parameter values.

To run a parameterized report, you typically must know which values to type. A report might include drop-down lists of valid values from which to choose.

To set parameter properties (including default values) on a published report, use Report Manager. For more information, see Parameters (Report Builder 3.0 and SSRS) and Setting Parameters in a Subscription.

Setting Parameters on a Report URL

Another way to run a parameterized report is through a URL. You can specify one or more parameters in encoded name-value pairs, using the ampersand character (&) to separate them.

Null parameters use special syntax; you must specify isnull for a null value. If you specify a null value for a parameter, all other values specified for that same parameter are ignored. The following example illustrates multiple parameters for null and constant values:

http://exampleWebServerName/reportserver?/foldercontainingreports/orders&division=mailorder&region=west&sales:isnull=true

Parameters with multiple values are specified by repeating the parameter name. For example:

http://exampleWebServerName/reportserver?/foldercontainingreports/orders&region=east&region=west

Boolean parameters are specified with a value of 0 or 1.

Float parameters must include the decimal separator of the server locale.

DateTime parameters must be specified with the format YYYY-MM-DDTHH:MM:SS, which is based on the International Organization for Standardization (ISO) 8601 standard. For more information about setting parameters on a URL, see Using URL Access Parameters.