This document describes the main uses of report parameters, report parameter properties, and parameter values. Report parameters allow you to control the report's content, connect related reports, or use them as arguments in functions.
To design a report that uses parameters effectively, you need to understand how parameters and Data Source components work together, how parameters and expressions work together, and how to manage parameters.
Parameters may contain single or multiple values. In case they have pre-defined values (i.e. Available Values), the latter may be static or dynamic (e.g. query-based) collections. The parameters may be allowed to have BLANK and NULL values. Other usages of the report parameters are:
- in data binding - to vary report data retrieved from a Data Source component
- in expressions - to directly provide a value
- in data item filtering, sorting or grouping criteria
After a report parameter is created, you can modify the default values and other parameter properties, such as visibility.
For example, you might want to create a report with a hidden parameter that selects data specific to the user running the report. Or you can filter the displayed results in a table item, based on the selection of the report parameter.
Report parameters can have the following properties:
Determines the type of the values that are acceptable. The allowed types are
Integer(values are converted to
Float(values are converted to
String. Acceptable values for each type are listed here: ReportParameterType The default parameter type is
Specifies the parameter name. Use it to access the parameter. The name must be a valid identifier - may contain only digits (0-9), letters (a-z, A-Z), and underscore sign (_). Must begin with a letter or underscore.
Used to specify a value for the parameter. It can be blank, a value of the allowed types, an Expression that evaluates to a value of the allowed types, or IEnumerable containing values of the allowed types.
When a parameter accepts multiple values (MultiValue=True), you can set the value by programmatically assigning an IEnumerable of the allowed types.
Specifies the text for the parameter to be displayed in the report viewer as a prompt to the end user. It can be blank, string, or Expression. May be accessed in Expressions with the Global Object
=Parameters.[Parameter Name].Text. If not set, the
Nameof the parameter will be used instead.
When you use an Expression to set the property, data fields should not be used and respectively they are not listed in the Edit Expression Dialog.
Specifies whether the editor will have UI in the parameters area. If you turn on the
Visibleproperty for at least one report parameter, the parameter area is shown when previewing the report in the report designer or in the report viewer.
Determines if null (Nothing in VB.NET) value is acceptable.
Applied only when the parameter is of type
String. Determines if an empty string is acceptable.
Determines if a collection of values (of the specified
Type) is acceptable as a value of the parameter. Parameters with
MultiValueturned on are mainly used with the IN logical operator.
The available values, or valid values, are a set of predefined values which are acceptable as the value of the parameter. Each available value may have a label that will be displayed if the parameter is visible. To define available values for a parameter you need to set the following nested properties:
The optimization for reusing the raw data from the same DataSource component introduced with R3 2019 (126.96.36.1998) is valid only for data items. It doesn't concern the Report Parameters with AvailableValues relying on DataSource components. Even if there are several parameters that fetch their AvailableValues from the same DataSource, the latter will be called once for each parameter.
ValueMember– a column name, expression, or embedded expression based on the DataSource schema. It is used as
Valuein the value/label pair. May be accessed in Expressions with the Global Object
DisplayMember– a column name, expression, or embedded expression based on the DataSource schema. It is used as
Labelin the value/label pair. May be accessed in Expressions with the Global Object
=Parameters.[Parameter Name].Label. If omitted the
ValueMemberwill be used as
DisplayMemberas well. Optional.
At design time, you can use the Data Source Wizard to select an existing or to create a new data source.
Controls parameter merging in ReportBook. The default value of the Mergeable property is true. Set the Mergeable property to false if you want to prevent a parameter from being merged with its equivalent ones.
Determines whether to trigger the report preview after changing the value for a parameter. Applies only to visible parameters. The default value is False.
When a report enters the processing stage, its value is validated against its validation properties. If one or more parameters do not have valid values, processing is aborted. The following properties are used to validate the supplied parameter’s value:
A Parameter is populated by setting its
Value property. You may set this property to a valid value or an expression that evaluates to a valid value. The expression evaluation and validation are performed while the report is processed. An expression used as a parameter value may not contain a reference to the built-in
Fields collection, as fields are still not populated when the parameters are processed.
Report Parameters' value can be populated in one of the following ways:
- At design time through the ReportParameter Collection editor
- Using the automatic user interface that each Report Viewer provides.
- Programmatically by using the
- Using a SubReports
Cascading parameters provide a way of creating dependencies between parameters to handle large amounts of input data. You can define a set of parameters where the list of available values for one parameter depends on the values chosen in other parameters.
For example, the first parameter could present a list of product categories. When the user selects a category, the second parameter is updated with a list of subcategories within the category. A third parameter could then display a list of products within the selected subcategory. The value for the product parameter is used to filter the report to a particular product. The parameters whose values depend on other parameter values are known as cascading, dependent, or hierarchical parameters. For more details on how to use cascading parameters, see the following documents:
- How to Cascade Parameters with applied filtering on Report level
- How to Cascade Parameters with applied filtering on data source level
The Report Parameter is processed as a whole entity. Its evaluation starts after all its dependencies, for example, other Report Parameter values have been evaluated. If, for example, the Text property is set with an Expression that can be evaluated and the Value property depends on another Report Parameter, whose value is unknown/invalid, neither the Text nor the Value property will be set.
When at least one report parameter has its
Visible property turned on, a parameter area is shown as part of the report viewer. This helps the report developer to easily provide an input method for the end users. Based on the settings of the parameters, a suitable editor UI is created. The parameter's layout on the parameter area is formatted automatically. The order is determined by the order in which the parameters appear in the ReportParameters collection. The end user can enter or select values in the editors. When at least one visible report parameter has the
AutoRefresh property turned off, a
Preview button is available. In this case, to preview the report, the end user must click the
Preview button. If all parameters have default values, the report runs automatically on the first view. You can show or hide the parameters area from the
Parameters button in the report viewer’s toolbar.