Sometimes it's useful have parameters in your report. Parameters can help you filter your data or specify a value that will be used to calculate other values (in the latter case, use calculated fields).
To add parameters and filter your report based on their values, follow the steps below.
-
In the Field Listwindow, right-click over the Parameterssection, and in the invoked menu, click Add Parameter.
Repeat this action to create the second parameter.
-
In the Field List, select the first parameter, and in the Property Grid, set its (Name)to FromDate, Descriptionto From:and Parameter Typeto Date Time.
For the second parameter, set these properties as shown in the following image.
Note That's it - you have created two report parameters. Every time you preview your report, you will be asked to enter their values. The following instructions explain how to use these values to filter your report's data.
-
Select the report(by clicking anywhere over the blank space in the report designer), and in the Property Grid, locate the Filter Stringproperty and click its ellipsis button. The FilterString Editorwill appear.
In this dialog, define the required expressions involving the created parameters.
Note Make sure that the report's Request Parametersproperty is set to Yes, as it is by default. Otherwise, the parameters won't be requested during the preview, and as a result, you'll get a blank report.
The parameterized report is now ready. Switch to the Preview Tab, and in the Parameterssection, define the required values and click Submit.
See Also