Calculate Fields
Calculated fields are primarily used in data-aware reports when you are using both standard data binding and mail merge. Calculated fields allow you to pre-process a report's input data based on a certain expression. Using calculated fields allows you to apply complex expressions to one or several data fields that are obtained from your report's underlying Data Set. You can also both sort and group your report's data based on a calculated field's value.
Calculated Fields Overview
Calculated fields are accessed via a report's Calculated Fields property.
At design time, they are managed via the Field List.
A value of a calculated field is obtained by evaluating its Expression, which is specified by its Expression property's text. The Expression Editor can be used to visually construct a calculated field's expression. In the Field List, it is invoked by a right-click over a calculated field, and choosing the Edit Expression... item in the invoked popup menu.
Then, you can use the dialogue to construct the required expression.
This expression can be built upon data fields (which are obtained from the data table defined by the Data Set and Data Member property values), report parameters and different date-time, logical, math and string functions surrounding them.
A data field is inserted into the expression's text using its name in [square brackets], and parameters are inserted using the "Parameters." prefix before their names. Date-time constants must be wrapped in #hashes# ([OrderDate] >= #1/1/2009#). To represent a null reference (i.e. one that does not refer to any object), use a question mark ([Region] != ?). Use 'apostrophes' to denote strings, otherwise an error occurs. To embed an apostrophe into an expression's text, it should be preceded by another apostrophe (e.g., 'It''s a sample text').
The type of a value returned by a calculated field is defined by its Field Type property.
If a calculated field expression involves using different types, you must convert them to the same type (e.g., Max(ToDecimal([Quantity]),[UnitPrice]))
You can sort and group your report's data based on your calculated fields' values.