TableLookup()

Format

TableLookup(Dataset ,SearchColumn ,ReturnValueColumn ,LookupValue [,InterpolationMethod])

Returns

The lookup result, which will be either a single value or a tag, depending on the lookup value. If any lookup value is outside the range of the dataset, the corresponding result will be an error value. 

The function enables linear interpolation between two values to find and calculate a result, and could replace, for example, tank strapping tables. The volume of liquid in a tank can be calculated from the measured height of the liquid in the tank, with linear interpolation being applied when the height is between two mapped height values.

Inputs

Dataset: The name of the dataset in Server Management that the lookup is coming from. If it doesn't have at least two rows, or it has some duplicate values in the search column, an error is returned.
Behaviour: Required
Dimensions: Matrix
Valid data types: Null, Boolean, DateTime, Decimal, Integer, String, Duration

SearchColumn: The index or name of the column to search for the lookup value. This column should have numeric data, otherwise an error is returned.
Behaviour: Required
Dimensions: SingleValue
Valid data types: Integer, String

ReturnValueColumn: The index or name of the column to use for the return value. This column should have numeric data, otherwise an error is returned.
Behaviour: Required
Dimensions: SingleValue
Valid data types: Integer, String

LookupValue: The value to look up. This can be a single value or multiple values.
Behaviour: Required
Dimensions: Collection, SingleValue
Valid data types: Decimal, Integer

InterpolationMethod: How to find a value when the search column doesn't match exactly. Options are Floor (value immediately below), Ceiling (value immediately above), Round (value below or above, switching half way between) or Linear (use linear interpolation). Defaults to Floor.
Behaviour: Optional
Dimensions: SingleValue
Valid data types: String

Points to Note

  • Conversion of floating point data could result in some unexpected behaviour.
  • Use high precision data types where possible.

Examples

Expression: TableLookup({TankStrappingData, TankName="Tank 1"}, 0, 1, 3)
Result: Single value of 50000, which is the matching value in the TankStrappingData dataset for the lookup value 3, using the default Floor interpolation method.

Expression: TableLookup({TankStrappingData, TankName="Tank 2"}, 0, 1, {Tag}, "Linear")
Result: Tag value of {TransformedTag}, in which each value is the matching value in the TankStrappingData dataset, using Linear interpolation.

Release History

  • TableLookup() 4.13.2
    • Initial version

Comments are closed