About expressions
When you create a computed column, you build or create an expression that indicates how to calculate data. When you build an expression to create a computed column, first select a category, then select a function to use to compute the data. Interactive Viewer provides an expression builder containing categories with functions and operators that you use to create, modify, and view expressions. You can select the columns across which to perform the calculation.
Figure 6‑2 shows an example of building an expression to calculate the extended price, which is not included in the report.
Figure 6‑2 Building an expression
If you are already familiar with writing expressions, you can create custom expressions to insert computed columns in a report. In the example, as shown in
Figure 6‑3, 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:
[PRICEEACH]*[QUANTITYORDERED]
Figure 6‑3 Performing a calculation
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 in 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:
TRIM([CustomerName])