Articles in this section

How to create Optional Parameters in Bold Reports

Published:
Updated:

Bold Reports lets you set optional parameters for your reports. This is useful when a report has several parameters but the reader only needs to supply a value for a few of them. The reader passes a value for every mandatory parameter and at least one parameter from each optional group, so the report renders without requiring a value for every parameter.

Applies to: Bold Reports Report Designer and Report Viewer · RDL reports · Enterprise/Server and Embedded

When to use this

Use optional parameters when a report has several parameters but the reader only needs to fill in some of them. Group the optional parameters together so the report renders as long as the reader supplies a value for at least one parameter in the group, instead of forcing a value for every parameter.

Steps to set optional parameters in Bold Reports

  1. Create a new report with the parameters you want to use. Edit each parameter you want to make optional and enable the Allow blank value (“”) checkbox, then save the parameters.

    image.png

  2. Click the grey area of the report and open Custom Properties in the properties panel.

    image.png

  3. Add the following custom property:

    • OptionalGroupParameters: Set this property in the following format to use the optional parameter custom property. The property lists the names of the optional parameters. For example, to group Param2, Param3, and Param4, set the optional parameter custom property in the following format.
      image.png
    'OptionalGroupParameters' : 'ReportParameterName1,ReportParameterName2,ReportParameterName3...'
    

    The reader must pass values for at least one parameter in the group to render the report.

  4. Save the report. In this example the report has four parameters (Param1, Param2, Param3, and Param4). Param2, Param3, and Param4 are grouped as optional parameters. The report renders when the reader passes values for every non-optional parameter and at least one of the optional parameters (Param2, Param3, or Param4).

    In the following example, values are supplied for at least one optional parameter and for all non-optional parameters, so the report renders correctly.

    image.png

    image.png

    In the following example, values are supplied only for the non-optional parameters and no value is supplied for any optional parameter. The system shows an error asking the reader to pass a value for at least one optional parameter.

    image.png

    The optional parameters feature was introduced in Bold Reports 5.1.28. Upgrade your NuGet packages and scripts to this version or later to use the feature.

Sample Report: OptionalParam.rdl

See also

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied