Calculated Columns
Calculated columns use existing columns and/or mathematical expressions to calculate the value of another column. Calculated columns are defined using an Expression Editor.
In the example below, there is a calculated column whereTotalDepth = DepthTo - DepthFrom
The data type of the calculated column is Decimal, the same as that of the columns used to build the expression.
The Editor type is defined as "Calculated". Once the editor has been chosen as calculated, you are required to create the expression used to calculate the values for the column.
Click on the tool drop-down arrow next to Calculated, then click on the ellipsis (...) next to Expression to open up the Expression Editor.
In the Expression Editor you can type an expression manually, or select functions, operators and operands using the editor's controls.
An expression is a string that evaluates to some value. Expressions consist of column names, constants, operators and functions. Column names must be enclosed in square brackets, which happens automatically when a column is selected from the Columns list.
The following are examples of regular expressions:
“[Quantity] * [UnitPrice] * (1 - [BonusAmount])”
“[FirstName] + ‘’ + [Lastname]”
Boolean expressions:
“[Country] == ‘Australia’”
“[OrderDate] > #06/09/2017# AND [Quantity] > 20”
The Expression Editor supports numerous standard functions, allowing you to easily perform simple or complex string, date-time, logical and mathematical operations on your data.
You can edit the expression manually using the keyboard, or by selecting available fields, functions, operators and constants: