Parameters Collection References (Report Builder and SSRS)

 

Applies To: SQL Server 2016

Report parameters are one of the built-in collections you can reference from an expression. By including parameters in an expression, you can customize report data and appearance based on choices a user makes. Expressions can be used for any report item property or text box property that provides the (Fx) or <Expression> option. Expressions are also used to control report content and appearance in other ways. For more information, see Expression Examples (Report Builder and SSRS).

When you compare parameter values with dataset field values at run time, the data types for the two items you are comparing must be the same. Report parameters can be one of the following types: Boolean, DateTime, Integer, Float, or Text, which represents the underlying data type String. If necessary, you might have to convert the data type of the parameter value to match the dataset value. For more information, see Data Types in Expressions (Report Builder and SSRS).

In order to include a parameter reference in an expression, you must understand how to specify the correct syntax for the parameter reference, which varies depending on whether the parameter is a single-value or multivalue parameter.

System_CAPS_ICON_note.jpg Note


You can create and modify paginated report definition (.rdl) files in Report Builder and in Report Designer in SQL Server Data Tools. Each authoring environment provides different ways to create, open, and save reports and related items.

The following table shows examples of the syntax to use when you include a reference to a single-value parameter of any data type in an expression.

ExampleDescription
=Parameters! <ParameterName> .IsMultiValueReturns False.

Checks if a parameter is multivalue. If True, the parameter is multivalue and it is a collection of objects. If False, the parameter is single-value and is a single object.
=Parameters! <ParameterName> .CountReturns the integer value 1. For a single-value parameter, the count is always 1.
=Parameters! <ParameterName> .LabelReturns the parameter label, frequently used as the display name in a drop-down list of available values.
=Parameters! <ParameterName> .ValueReturns the parameter value. If the Label property has not been set, this value appears in the drop-down list of available values.
=CStr(Parameters!  <ParameterName> .Value)Returns the parameter value as a string.
=Fields(Parameters! <ParameterName> .Value).ValueReturns the value for the field that has the same name as the parameter.

For more information about using parameters in a filter, see Add Dataset Filters, Data Region Filters, and Group Filters (Report Builder and SSRS).

The following table shows examples of the syntax to use when you include a reference to a multivalue parameter of any data type in an expression.

ExampleDescription
=Parameters! <MultivalueParameterName> .IsMultiValueReturns True or False.

Checks if a parameter is multivalue. If True, the parameter is multivalue and is a collection of objects. If False, the parameter is single-valued and is a single object.
=Parameters! <MultivalueParameterName> .CountReturns an integer value.

Refers to the number of values. For a single-value parameter, the count is always 1. For a multivalue parameter, the count is 0 or more.
=Parameters! <MultivalueParameterName> .Value(0)Returns the first value in a multivalue parameter.
=Parameters! <MultivalueParameterName> .Value(Parameters! <MultivalueParameterName> .Count-1)Returns the last value in a multivalue parameter.
=Split("Value1,Value2,Value3",",")Returns an array of values.

Create an array of values for a multivalue String parameter. You can use any delimiter in the second parameter to Split. This expression can be used to set defaults for a multivalue parameter or to create a multivalue parameter to send to a subreport or drillthrough report.
=Join(Parameters! <MultivalueParameterName> .Value,", ")Returns a String that consists of a comma-delimited list of values in a multivalue parameter. You can use any delimiter in the second parameter to Join.

For more information about using parameters in a filter, see Report Parameters (Report Builder and Report Designer).

Expressions (Report Builder and SSRS)
Commonly Used Filters (Report Builder and SSRS)
Add, Change, or Delete a Report Parameter (Report Builder and SSRS)
Tutorial: Add a Parameter to Your Report (Report Builder)
Report Builder Tutorials
Built-in Collections in Expressions (Report Builder and SSRS)

Community Additions

ADD
Show: