V1
V1

Parameters

You can use parameters to filter or add the data to display in reports at run time. You can either prompt users for parameters so that they control the output or supply the parameters behind the scenes.

Add a parameter

  1. Go to Parameters in the right pane of the designer and click Add. The new parameter will be displayed under PARAMETERS.

  2. Click the added parameter to open the Edit Parameter pane.

  3. Set the following values for parameter settings in the Edit Parameter pane.
    Name field: Specify the parameter name.
    Prompt field: Enter the text you want to see on the user interface to request information from the user in this field. By default, this is the same as the Name property.
    Data Type field: Set the data type for your parameter which must match the data type of the field that it filters.

    • Boolean: Presents the user with two options True or False
    • Date: Presents the user with a calendar picker to select a date if you do not supply a default value or a drop-down selection of available values
    • DateTime: Presents the user with a calendar picker to select a date and a time picker to select the time in cases where you do not supply a default value or a drop-down selection of available values
    • Integer: Presents the user with a text box or a drop-down selection of available values
    • Float: Presents the user with a text box or a drop-down selection of available values
    • String: Presents the user with a text box or a drop-down selection of available values.

    Multivalue field: Select this check box to allow the user to select multiple items in the available values list. For a multi-value parameter, you can also allow user to specify special value for 'Select all' option in the Value for 'Select All' property.
    Hidden field: Select this check box to hide the parameter interface from the user and instead provide a default value or pass in values from a subreport or drill-through link. Please note that if you hide the user interface and do not provide a default value, the report will not run.
    Allow Null Value field: Select this check box if you want to allow null values to be passed for the parameter.
    Multiline field: Select this check box to allow multiline values in the parameter. The control will automatically adjust to accommodate multiple lines. It is only available for String data type.
    Allow Blank Value field: Select this check box if you want to allow blank values to be passed for the parameter. It is only available for String data type.

  4. Add Available Values that are used to fill a drop-down list from which the end user can choose.
    From query: You can select a Dataset from which to select a Value field and Label field.
    Non-queried: You can supply Labels and Values by typing in static values or using expressions. To specify an expression, click Expression to open the Expression Editor.
    Note: In the Available Values tab the Value is what is passed to the query parameter, and the Label is what is shown to the user. For example, if the Value is an Employee Number, you might want to supply a more user-friendly Label showing Employee Names.

  5. Add default values, which is the value that you give for the parameter if the user does not supply one, or if you hide the parameter user interface.
    Non-queried: You can supply a default Value by entering a static value or using an expression. To specify an expression, click Expression to open the Expression Editor.
    From query: You can select a Dataset from which to select a Value field.

  6. To exit the Edit Parameter pane, click the Back icon.

Delete a parameter

Hover the cursor over the parameter you want to remove, and click Remove icon.

Add a multi-value parameter

You can create a multi-value parameter by selecting the Multivalue option. In a multi-value parameter, you can choose a few options from the list or simply choose 'Select all' to select all options.

If there are large number of options to choose from, choosing 'Select all' option creates an SQL query too long for an SQL Command to run. In such a case, you can specify a value to the multi-value parameter in the Select All Value field.

Let us assume that we already have a report that displays Product details – Product ID, Name, Supplier ID, Quantity Per Unit and Unit Price fields. Using the following steps we will add a multi-value parameter and filter our report according to the 'Name' field.

  1. Create a dataset to populate the parameter values. To do so, select the Products Data Set under the Data tab and click the Edit Data Set.. option.

  2. In the Edit Data Set dialog, enter a query like the following into the Query text box.
    $.[*].name

  3. Click Validate and then OK to close the dialog.

  4. Add a report parameter - go to Parameters in the right pane of the designer and click Add. The new parameter will be displayed under PARAMETERS.

  5. In the Name field, enter a name for the parameter – for example, Parameter1. Ensure that the Data type matches that of the field (String type for name).

  6. In the Prompt field, enter some text for prompting users for a value field.

  7. Set Multivalue property to allow users to select more than one item from the list.

  8. To provide a list of values for the Report Parameter, go to Available Values > From query and in the Data Set Name field, select the dataset created at previous steps 1-3 (DataSet1).

  9. In the Value Field and Label Field, select the field from the drop-down list (name).

  10. Create a dataset with a parameter. To do so, right-click the Product Data Set and select Edit Data Set.

  11. In the Edit Data Set dialog, enter a query like the following in the Query text box:
    ="$.[?(@.name==""" & Join(Parameters!Parameter1.value, """|@.name==""") & """)]"

  12. Click OK to close the Data Set dialog.

  13. Click Preview to preview the report with a multi-value parameter.