This page shows examples of calculated fields in data blocks, including their definition in Enterprise Studio. The examples vary from simple calculations to more complex calculations.
You may notice that sometimes spaces are used in the expression and sometimes not. It is optional. You can choose to use spaces for readability, but it is not required and it does not affect the functionality.
For defining calculated fields it is assumed that you have some familiarity with scripting.
On this page:
Data block with one calculated field with only a calculation
The following data block has one calculated field with only a calculation. This is sufficient because the calculated field as well as the attribute fields used in the expression are of a number-related type (real and integer). Because of these no mappings are needed.
Data block with one calculated field including input mappings
The following data block has one calculated field of type integer. Since the other attribute fields that are used in the expression are of type enumeration, input mappings are needed to convert their values.
Data block with one calculated field including an output mapping
The data block below has one calculated field of type enumeration and therefor needs an output mapping in the expression. The result of the calculation (a number) needs to be mapped back to an enumeration value that fits the type of the calculated field.
Data block with two calculated fields, one using the other's calculated value
The data block in the following example has two calculated fields defined, one of type real and one of type integer. The calculated field of type real uses the calculated value of the other calculated field.
Data block with four calculated fields, one using the others' calculated values
The data block below has four calculated fields, of which one is using the calculated values of the other three fields. The calculated fields use a variety of expressions.