Page tree
Skip to end of metadata
Go to start of metadata

You create a calculated field for the Data Source 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 from the Calculated Fields tab, complete the following steps:

  1. In the  Field Name field, enter a short name for the calculated field. 

    • This name becomes the ID of the field in the Data Source. After, you can give the field a more meaningful label and full description. 

  2. In the  Type field, 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—it is helpful to be familiar with the datatypes of columns in the data source. 

  3. In the  Expression field, enter an expression to compute the value of the calculated field. 

    • You write expressions in the Data Source Expression Language 

    • To insert a reference to the value of another column, 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. You can also double-click a calculated field name to insert a reference to it in any expression. 

      Do not insert a column reference from unjoined trees. The Data Source Designer does not validate expressions as they are written, and the unjoined trees will not be valuable.

       

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

After saving the calculated field, the Data Source 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.
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, follow the steps below:

  1. Cancel any input in the  Calculated Field Editor

  2. In the  Available Fields panel, double-click the name of the field you wish to edit. 

  3. Modify the contents of the  Field Name,  Type, or  Expression fields. 

  4. Click the  Save Field button to save the new definitions. To delete the calculated field from the Data Source, click the  Delete Field button. To cancel any changes, click the  Cancel button. 

  • No labels