Calculated fields
You can include calculated fields on your report design. The calculated field values output on the report represent the calculation as defined in the report design.
You can define a calculated field and use this like any standard data field throughout the report.
Note: Calculated fields are displayed on the
Fields list with a special icon. You can edit calculated fields after they have been
added to the report design. You can sum calculated fields using the Summary Fields function, use them in
expressions, or use them as conditions within expressions. Right-click the calculated
field and select Edit Field.
- Select Calculated Field from the Insert menu. The Edit Field dialog is displayed.
-
Specify this information:
- Name
- Enter a name for the calculated field. This is used as the field alias and must not already exist in the Field list. An error message is displayed if this name is not unique or is in an invalid format.
- Data Field, Parameter or Special Field
- Select this option and click Browse to display the Select a Data Field dialog containing the Fields, Data Fields, and Special Fields browser panes. Once a field is selected, any value in the Expression field is cleared.
- Expression
- Select Expression and click Browse to open the Value Expression dialog. From the Value Expression dialog, click Browse and then the Expression tab where you can type a value directly into the Expression box.
- Alternatively, you can click the Fx icon below the
Expression box
to display the Expression Builder where you can select and then insert
fields, parameters, report items, scopes and functions into the expression
using the Insert button. The
expression can be:
- A constant
- A known global value like Today, or Value
- A parameterized function like DateDiff
- A pass through expression (for example, the sum of two fields).
- Enter a value for the default case statement.
- Click Add Case. The value entered is displayed on a tabbed dialog labeled Case 1 to the left of the default case. The default case is always shown to the right of the other cases.
- Click the Browse button to redisplay the Enter Field/Expression dialog. Enter the options required and click OK.
- Select Standard Filter or Custom Expression.
-
Specify this information:
- Standard Filter
- Select a value for the expression by clicking the Browse button for the field. The Enter Field/Expression dialog is re-displayed, allowing you to enter a data field, parameter or special field, or enter a custom expression.
- Select a condition from the drop-down list.
- Select an expression by entering a value directly or by clicking the Browse button for the field. The Edit Field dialog is re-displayed, allowing you to enter a data field, parameter or special field, or enter a custom expression.
- You can lookup the value using the same lookups as are defined in parameter entry and return these to the field. The values returned in the lookup depend on the data type of the parameter or the field selected on the left side of the condition. You can add any number of conditions.
- Custom Expression
- You can copy the set of conditions for a particular case to use as the basis of a custom expression.
- Once copied from a standard expression, you can use the undo feature to redress the situation but cannot copy expressions back to the standard after they have been amended.
- You can add more cases as required. You can change the priority of cases by selecting a case and using the arrows. Any case or condition can be deleted.
- Save your changes.