Report Parameter is a type of a report parameter that uses a mapped value. This value is defined as a parameter mapping in the model element that calls the report, e.g. a workflow step or a UI action.
ATTRIBUTES
AllowsNulls | Default value is set to True . |
DataLength | Depending on the data type fill in the desired data length, e.g. 8 for a date or 100 for a string. |
DataType | Select the data type of the parameter. |
SSRS Setup of an optional parameter
Sometimes you have a parameter in your report that is optional - when filled the data should be filtered by this parameter, but when left empty all values should be taken. In the model you define it by setting the parameter attribute AllowsNulls=True
. When using SQL Server Reporting Services there are several steps to take.
- in the
Query
tab ofDataset Properties
define the parameter in the WHERE clause like this
WHERE (refCustomerId = @CustomerId OR @CustomerId IS NULL)
- in the
Parameters
tab ofDataset Properties
define the parameter value as a function
=IIF(Parameters!CustomerId.Value = "", Nothing, Parameters!CustomerId.Value)
- in the
General
tab ofReport Parameter Propertions
check theAllow blank value ("")
option