It can be useful to add parameters to the report. For example if you want to issue a report for a single customer, employee, product, or project but not for all customers, employees, etc. In order to do so you have to define a workflow variable and select it in the node you want to parameterize.
The report parameters are automatically added when you subsequently switch to the report. During runtime (when the report is generated) the user is prompted to enter a value for this variable. The value is inserted into the related node, in which the variable is used. This concept is explained below in more detail:
When building the workflow, right-click the opened workflow in the window Workflow Projects and select the context menu entry Workflow Variables…
A dialog opens that allows you to add, edit or remove workflow variables:
When adding a workflow variable you have to enter
- a unique name for the variable
- a type (either string, double, or integer)
- and a default value
Once the workflow variable has been added, the source nodes of the workflow have to be reset in order to propagate the variable throughout the workflow.
Now the variable can be used in order to parameterize the nodes. Open the dialog of the node you want to parameterize and select the “Flow Variables” tab, where you can select the workflow variable:
This replaces the actual value of this setting with the value of the variable at runtime (when the workflow is executed).
When you switch to the report, the workflow variable is automatically added as a report parameter:
In order to edit this parameter, right-click it and choose Edit. A dialog opens in which you can set, amongst others, the following properties of the report parameter:
- the prompt text, displayed at runtime to the user
- the display type which can be
- a text field
- a combo box
- a list box
- or a radio button
- a help text
- and a default value
When generating or previewing the report the user is subsequently prompted to enter a value for this report parameter in a dialog similar to the one below:
If you do not want the user to enter free text but to choose from a provided set of values, select the combo box as display type and define which values should appear in the combo box.
You can define the selectable values statically and enter each of the values by clicking the New… button:
However, it makes more sense to import the values once, i.e. select the Static radio button and then click Import Values… which opens a wizard that enables data to be selected from an existing data set:
Another option is to import the values dynamically, i.e. each time the report is generated or previewed the values are retrieved from a data set.
If a combo box is selected as the display type, a report parameter prompt dialog is generated similar to the one below:
Once the user enters a value for the report parameter this value is inserted as a workflow variable in the underlying workflow and the workflow is re-executed again with this new value.