Inserting calculated data in a report
When you create a computed column, you type an expression that indicates how to calculate the data. In the example report shown in Figure 5-2, you multiply each value in the QUANTITYORDERED field with the corresponding value in the PRICEEACH field, to obtain the value in the Total column. The following expression calculates the Total:
When you use a data field in an expression, you must enclose the field name within brackets ([ ]).
Interactive Viewer supports typical mathematical operations, such as addition, subtraction, multiplication, and division. In addition to mathematical calculations, Interactive Viewer supports functions for processing date-and-time and string data.
You can create a computed column to display data that is not displayed on the report, or if you want to display data differently from its appearance in the report. For example, if a customer name field contains values with leading or trailing blank characters, you can remove the blank characters by using the TRIM( ) function as follows:
Figure 5-2 Performing a calculation