Report Parameters

Report parameters are special variables that enable users to control report data and appearance. When you publish a report to a Report Server, parameters become available to the end-user in the report viewer. This allows them to customize the report output by selecting values for these parameters.

Purpose of Report Parameters

Creating Report Parameters

You create and manage report parameters within Report Designer (part of SQL Server Data Tools - SSDT). The process typically involves:

  1. Opening the Report: Open your .rdl file in Report Designer.
  2. Report Data Pane: Locate and expand the 'Report Data' pane.
  3. Parameters Folder: Right-click on the 'Parameters' folder and select 'Add Parameter...'.
  4. Parameter Properties: A dialog box will appear allowing you to configure the parameter's properties.

Parameter Properties

When creating or editing a parameter, you'll configure several important properties:

General Properties

Default Values

Available Values

Visibility

Using Parameters in Reports

Once defined, parameters can be used in various parts of your report:

In Dataset Queries

Parameters are commonly used to filter data in your report's datasets. If your dataset query is for SQL Server, you'd use the parameter name preceded by an '@' symbol.

SELECT ProductName, SalesAmount FROM SalesData WHERE Territory = @SalesTerritory AND OrderDate BETWEEN @StartDate AND @EndDate;

In Expressions

Parameters can be referenced in report expressions (e.g., in text boxes, charts, or tablix properties) using the following syntax:

=Parameters!ParameterName.Value

For example, to display the selected territory in a report title:

="Sales Report for " & Parameters!SalesTerritory.Value

Parameter Types and Features

Tip: Design your parameters carefully to provide a good user experience. Clear prompts and well-defined available values make reports much easier to use.

Troubleshooting Common Issues

Report parameters are a fundamental feature of SQL Server Reporting Services, offering powerful interactivity and customization for your reports.