Skip to content

is_key

Syntax

is_key(table_name, key)

Parameters

table_name
The name of a table or list_table variable in the model.
key
The key to check.

Returns

Returns 1 (true) if the key provided exists in the table, and 0 (false) otherwise.

Description

Checks if a key has been assigned a value in a table or list_table variable.

Examples

The following checks if a key with value 200 exists in a table called T, and if it does, prints the value:

if (is_key(T, 200)) {
    print(T[200])
}