You create a calculated field for the Domain by writing an expression that computes a value based on the data in one or more columns of the same join tree. All columns 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. |
| 2. | In Field Name, enter a short name for the calculated field. This name becomes the field's ID 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 in the expression. |
| Do not insert a column reference from unjoined trees. The Domain Designer does not validate expressions as they are written, and the unjoined trees will not be available. |
| 5. | Click Save Field to save the new calculated field. |
After saving the calculated field, the Domain Designer validates the expression and warns you of any errors. 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. In Available Fields, you'll recognize calculated fields by this icon .
An expression that uses no 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.
Recommended Comments
There are no comments to display.