For your report, you can employ parameters which can be requested each time the report is being previewed. Based on specified values the report will then be filtered. It is also possible to employ parameters in expressions of calculated fields.
In this example, we'll create two date-time parameters to filter out orders which don't fall in the specified range from the report.
To add parameters and filter your report based on their values, follow the steps below:
1. In the Field List window, right-click over the Parameters section and in the invoked menu, click Add Parameter.
2. In the invoked window for the created parameter, set its Name and Description. And, make sure to set its Type to an appropriate value.
3. Enabling the Supports the collection of standard values option of the parameter allows end-users to modify its value and also activates the Dynamic values and the Static values tabs of the window:
- On the Dynamic values tab, you can specify a parameter's data source, data adapter and data member. The value member defines a data field that provides values to the parameter. The display member defines a data field that provides display names for parameter values (how these values appear in the user interface available in a Print Preview).
- On the Static values tab, you can manually fill the list of parameter values, with each value having an individual description (specifying how this value appears in the Parameters panel).
Then, repeat the previous steps to create the second parameter, so that every time your report is previewed, you will be asked to specify two dates.
The following instructions explain how to use parameters to filter your report's data:
4. Click your report's Smart Tag, and in the invoked actions list, click the ellipsis button for the Filter String entry. Then, in the invoked Filter String Editor, construct an expression where a data field is compared with the created parameters. To access parameters, click the icon on the right until it turns into a question mark.
The complete filtering expression will then look like this.
The parameter report is now ready. Switch to the Preview Tab and in the Parameters section define the required values and click Submit.