ActiveReports allows you to add calculated fields to a report using the Report Explorer, or you can use the DataField property of any textbox to perform calculations based on the value of specific data fields. This how-to topic multiplies the values of two bound fields, but you can use any valid Field Expression operators. See the Add Field Expressions topic for more information.
To create a calculated field
- In the Report Explorer, expand the Fields node, right-click on the Calculated node, and select Add. This creates an unbound field named "field1" that can be used to perform custom calculations.
- With field1 selected in the Properties Window, change the Formula property to =Quantity * UnitPrice to bind it to the product of the Quantity and UnitPrice fields, substituting the names of fields that you have under the Bound node in your report.
- Change other properties as desired.
- Drag the field from the Calculated node onto the detail section of the report. This creates an ActiveReports TextBox object, and sets its DataField property to the name of the calculated field.
See Also