GET

GET(map_object, key)[source]

Retrieves the value associated with a specified key from a map field.

The GET function looks up a key in a MAP-type Operand and returns the corresponding value. The key must be a singular OBJECT reference to the same source table as the map.

Parameters:
  • map_object (Operand) –

    The MAP-type model component containing key-value pairs.

    Supported types:

    • STRING_MAP

    • INTEGER_MAP

    • DECIMAL_MAP

    • BOOLEAN_MAP

    • DATE_MAP

    • TIME_MAP

    • DATETIME_MAP

  • key (Operand) –

    The OBJECT-type key whose associated value is to be retrieved. Must reference the same table as the map and cannot be an array.

    Supported types:

    • OBJECT

Return type:

Formula

Returns:

A Formula object representing the value associated with the specified key. The data type will match the underlying data type of the map’s values. If the key does not exist in the, the formula will evaluate to an error.

Supported types:

  • STRING

  • INTEGER

  • DECIMAL

  • BOOLEAN

  • DATE

  • TIME

  • DATETIME

Raises:
  • ValueError – If map_object is not a MAP type.

  • ValueError – If key is not a singular OBJECT referencing the map’s source table.

Examples

Basic usage:

GET(my_map, some_object_key)
# Returns the value associated with `some_object_key` in `my_map`

Invalid key:

GET(my_map, another_table_object)
# Raises `ValueError` because the key references a different table