Calculated fields in data blocks use expressions that specify the operations and functions to be performed, the referenced attribute fields, and any needed value conversion. The tables below show the operations and functions that can be used in expressions of calculated fields.
For defining calculated fields it is assumed that you have some familiarity with scripting.
Operations
The following operations can be used in the expression of a calculation field:
Notation | Operation | Explanation |
---|---|---|
+ | Add | Adds the operands. If both operands are integer, the result is also integer. Otherwise the result will be real. Example: |
- | Subtract | Subtracts the right operand from the left. If both operands are integer, the result is also integer. Otherwise the result will be real. Example: |
* | Multiply | Multiplies the operands. If both operands are integer, the result is also integer. Otherwise the result will be real. Example: |
/ | Divide | Divides the left operand by the right. If both operands are integer, the operation will perform integer division and the result is also integer. In all other cases, the operation will be a proper division and the result will be real. Examples:
|
Functions
The following predefined functions can be used in the expression of a calculated field:
Notation | Function | Explanation |
---|---|---|
min | Minimum | Returns the smallest value among its arguments. |
max | Maximum | Returns the largest value among its arguments. |
sum | Sum | Returns the sum of its arguments. |
prod | Product | Returns the product of its arguments. |
avg | Average | Returns the arithmetic average value of its arguments: the sum of the values divided by the number of values. |
geoman | Geometric mean | Returns the geometric mean value of its arguments: the N-th root of the product of the values (with N equal to the number of values). |
sqrt | Square root | Returns the square root of its (single) arguments. |
abs | Absolute value | Returns its (single) argument unchanged if it. |
Parentheses and brackets
Notation | Operation | Explanation |
---|---|---|
( ) | Parentheses | Can be used for specifying the order of operations. Example: |
< > | Angle brackets | Can be used for referencing other attribute fields. Example: |
Check out the free Enterprise Studio introductory eLearning course to learn about data blocks.