3.3.2 Creating an Expression Column

Walkthrough

An expression column is a custom formula that generates a new column based on the values in other fields. You can use any valid JavaScript syntax within an expression. Power users are encouraged to read Appendix JS: General JavaScript Functions to learn about JavaScript functions.

To create an expression column, follow the steps below:

1. Launch any one of the Ad Hoc Wizards. In Step 1, select the desired data source.

The 'Create Expres­sion Column' link is available on subse­quent Wizard screens as well.

2. Proceed to Step 2 of the Wizard. Note the 'Create Expression Column' link at bottom.

 

3. Click the 'Create Expression Column' link. This opens the Formula Editor.

 

4. In the 'Name' field, enter a name for the new column.

5. Select the 'Return Data Type', which is the type of data the new column contains.

6. In the Formula Editor, select the 'sql' checkbox to enter the formula using SQL syntax. Leave the box unchecked to use JavaScript syntax.

7. Construct the desired formula using appropriate operators (SQL or JavaScript). To add a field name to the formula, click the desired name in the 'Fields' list.

For example, you can specify an SQL formula such as

field['Price'] * field['Discount']

with return data type 'Double'. You can specify a JavaScript for­mula such as the following with return data type 'String':

if (field['Discount'] > 0) {

   'Yes'; // return Yes

} else {

   'No'; // return No

}

<< 3.3.1 Creating a Table-Based Report © 1996-2013 InetSoft Technology Corporation (v11.5) 3.4 Crosstab Wizard >>