Skip to content

lookup_list

Syntax

lookup_list(list_table_name, key-expression)

Parameters

list_table_name
The name of a table variable.
key-expression
An expression that evaluates to a number.

Returns

Returns the list stored under the indicated key.

Description

This action returns the list-value stored under the given key in the indicated list_table.

This action is equivalent to list_table_name[key-expression].

If the key does not exist, a run-time error occurs.

Examples

simulation {
    start_date = 2020-Jan-01
    end_date = 2020-Jan-02
    locations = none
    default_model = none
}

variables {
    shared list_table x
    shared list y
}

condition ACTIVE {
    start_state = Excluded
    meta_start_state = MetaStart

    state MetaStart {
        x[40] = list(1, 2, 3)
        x[30] = list(4, 5, 6)
        y = lookup_list(x,40)
        # y now equals a list containing 1 2 3

        wait()
        next()
    }
}

See Also