TableLookup

Description

Table lookup to nearest value.

Type

NUMERIC

Arguments

Type

Meaning

1

SLOT

table slot in which to do lookup

2

NUMERIC

"from" column

3

NUMERIC

"to" column

4

NUMERIC

value in "from" column

5

DATETIME

datetime context for unit conversions

5

BOOLEAN

whether to round up (or down)

Evaluation

The value argument is looked up in the "from" column of the given table slot to determine the corresponding value in the "to" column. If the round up argument is true and exact value is not in the table, the lookup finds the row whose value is the smallest value larger than the lookup value and returns the value in that row’s "to" column. If the round up argument is false and the exact value is not in the table, the lookup finds the row whose value is the largest value smaller than the lookup value and returns the value in that row’s "to" column.

Comments

Error conditions which will lead to an error diagnostic and cause the run to halt include: the given slot is not a table slot, one of the two column indices are not valid for the table, the lookup value has units which are inconsistent with the from column of the table, or the search value is not contained within the table. Column numbers are zero based with a unit type of NONE.

 
TableLookup(Lake Mead.Elevation Volume Table, 0, 1,
1210.0 "ft", @"t", TRUE)
 
1323342 "acre-feet"