In This Topic
Parameters can be used to create expressions for calculated fields. To use parameters to perform various calculations in the report, perform the steps below:
- Run FlexReportDesigner.exe application.
- Create a new report. Bind it to Products table. The report opens in the Design mode.
- Click the Data tab.
- Right-click Data Sources and select Add Data Source. The Data Sources dialog box appears.
- Add another Data source and bind it to Products table. This data source is added for the parameter. Name this data source as 'dsProducts'.
- Add a parameter 'Parameter0' by right-clicking Parameters and then selecting Add Parameter.
- From the Properties window, click the ellipsis button next to AllowedValuesDefinition. The AllowedValuesDefinition Editor dialog box appears.
- Select the From Data Source radio button and then select Data Source - dsProducts, Label - ProductName, and Value - ProductName. Click OK.
- Add another parameter 'Discount'.
- Edit the 'Main' data source. Write following Sql statement:
Select * from Products where ProductName=Parameter0
- Add a Calculated field from the Fields group in the Insert tab. The VBScript Editor opens.
- Specify the following expression in the editor:
UnitPrice*Discount
- Drop the Calculated field in the Detail section. Also add a Text field to display 'Discounted Price' in the PageHeader section.
- Preview the report. Select the product name from Parameter0 and enter the discount value in Discount parameter. The discounted price is calculated on clicking Apply Parameters.