<< Click to Display Table of Contents >> Navigation: User Interface Reference > Report Designer > Report Designer for WinForms > Report Editing Basics > Add Calculated Fields to a Report |
Interface Elements for Desktop > Report Designer > Report Designer for WinForms > Report Editing Basics > Add Calculated Fields to a Report
This document demonstrates how to add a calculated field to a report. The main purpose of calculated fields is to perform pre-calculations (of virtually any level of complexity) over data fields. To learn how to easily perform simple calculations within a single data field, refer to Add Totals to a Report.
In the Report Designer, a calculated field is similar to an ordinary data field (e.g. you can bind controls to it, and group, sort and filter your report against it).
To add a calculated field to your report, follow the instructions below.
1.To create a calculated field, in the Field List, right-click any data member, and on the invoked menu, choose Add Calculated Field.
2.In the Field List, select the created field to show its properties in the Property Grid. Among these options, make sure to change the Field Type property to an appropriate value.
3.Now, let's create an expression for the calculated field.
Click the ellipsis button in the Expression section, to invoke the Expression Editor. You can also invoke this dialog by right-clicking your calculated field within the Field List and selecting Edit Expression...
Click Fields to see the field list. Double-click field names to add them to the expression string. Use the toolbar to add operators between field names.
Note
Note that it's also possible to employ parameters in a calculated field's expression.
To close the dialog and save the expression, click OK.
4.Finally, drag the calculated field from the Field List onto the required band, just like an ordinary data field.
The report with a calculated field is now ready. Switch to the Preview Tab, and view the result.
Change or Apply Data Filtering to a Report
Change or Apply Data Grouping to a Report
Change or Apply Data Sorting to a Report
Copyright (c) 1998-2016 Developer Express Inc. All rights reserved.
Send Feedback on this topic to DevExpress.