Name

columntest — Return a value from the data table or a default expression.

Syntax

columntest(label, relation, default)
              

The COLUMNTEST function has the following arguments:

label

The column name that is to be referenced.

relation

The name of the relation to retrieve the column from, in case there are duplicate column names.

type

A value to return in case the column does not exist.

Description

This function will return a value from the data table, or if the column does not exist then it will return the value of an expression.

The function will attempt to lookup the named data value. if the column exists the value will be returned. If the column does not exist then the expression will be evaluated and the value returned.

The first two arguments must be string literal values. As the expression is compiled the data table is checked for the existance of the required column.

The data type of the function is either the data type of the column (if it exists) or the data type of the expression.

Examples

Formula

Description

Result

columntest('slope', '', 1.0)Return the value of the slope column (if it exists), or the value 1.0 otherwise. The related table parameter is left unspecified.