Calculated Fields Tab

You create a calculated field for the Domain by writing an expression that computes a value based on the data in another column or columns. In order for the value to be coherent, all columns that appear in the expression for a calculated field must be from the same join tree.

To create a calculated field:

1. Select the Calculated Fields tab to begin defining a new calculated field.
2. In Field Name, enter a short name for the calculated field. This name becomes the ID of the field in the Domain.

Later you can give the field a more meaningful label and full description.

3. In Type, select a datatype for the calculated field. The expression you write must return a value of this type.

Generally, this datatype matches the datatype of the columns in the expression. Therefore, you need to be familiar with the datatypes of columns in the data source.

4. Enter an expression to compute the value of the calculated field.

Write expressions using the Domain Expression Language, fully described in The DomEL Syntax.

To insert a reference to the value of another column:

a. Expand the join-tree to find its table and double-click the column name.

The column name appears in the expression at the cursor, qualified by its table name.

Calculated fields may be used to compute other calculated fields.

b. Double-click the calculated field name to insert a reference to it into an expression.

Do not insert a column reference from unjoined trees because the Domain Designer does not validate expressions as they are written.

5. Click Save Field to save the new calculated field. To clear the calculated field editor without saving, click Cancel.

After saving the calculated field, the Domain Designer validates the expression and warns you of any errors at this time. If there are errors, use the indications of the error message to help correct the expression. After validation, a calculated field appears in the table or join tree whose columns are used in the expression.

Calculated fields have a distinctive icon, , for easy recognition in Available Fields.

An expression that does not use any columns has a constant value. For example, you might create an integer field named Count that has the value 1 and later has a default summary function to count all occurrences. Constant fields are independent of join trees and automatically appear in a set called Constants.

To view, edit, or delete the definition of a calculated field:

1. Cancel any input in the calculated field editor, then click the name of the field in Available Fields.
2. Modify its name, its type, or its expression.
3. Click OK to save the new definition, or click Cancel if you just viewed the field definition.

Click Delete Field to remove the calculated field from the Domain design.