Click Next. Click OK to dismiss the dialog box. Click OK or Apply in the View Editor.

Manipulating Data in Views 5-21

9. Click Next.

10. Map fields to external parameters to build a query string.

11. Click OK to dismiss the dialog box.

12. Click OK or Apply in the View Editor.

5.4 Adding Calculated Fields

You can add calculated fields to views in reports. You can create a calculation based on other fields in the view, for example, fields such as Sales and Costs. The calculator includes aggregate functions, string functions, and datetime functions that you combine with existing data fields to create calculated fields. Then, you can add these calculated fields to the view or create more calculated fields based on other calculated fields. If you create an aggregated calculated field for a list view, you are not able to add it as a field in the list. To add a calculated field: 1. Click the Data button in the View Editor. To open the View Editor, double-click the view you are editing, or click Edit view in the View TasksOptions list.

2. Select the Calculation tab.

3. Start a calculated field expression: ■ Select a number, operator, or parenthesis button on the calculator. ■ Select a field from the Field list and click Insert Field. ■ Select a function from Expression list and click Insert Expr. See Appendix A, Calculation Operators and Expressions for more information. ■ Type directly in the calculated field area. See Section 5.4.2, Using Decimal Type Numbers in Calculations for information about using Decimal type constants in calculation expressions. ■ Click Group By and select one or more fields to group by. You cannot group on a calculation that does not perform any aggregation.

4. When you have created the calculated field expression, click Enter.

A basic syntax check is performed and displays either a green check mark if the syntax passes or a red exclamation mark if the syntax does not pass. If the calculation passes the syntax check, the field is displayed in the calculated fields list on the right.

5. To add the field to the view, click the Fields tab in the View Editor and click the

check box next to the field name.

6. Click Apply or OK to update the view.

Note: You can insert HTML strings in an expression to add formatting to a calculated field. See Section 5.4.1, Using HTML in Calculations for more information.