Dictionaries

Syntax

	dict = {
  $key1: $value1,
  $key2: $value2,
  ...,
  $keyN: $valueN
}

Description

A dictionary is a static assignment of keys to values. In rare cases it can be useful to create such a dictionary explicitly via an expression by assigning a list of values value1 to valueN to a list of different keys key1 to keyN. Keys may occur only once, while values may be assigned to several keys.

The syntax is based on the widely used JSON syntax for structured data. Unlike pure JSON values, the keys are not limited to strings, but numbers or any other values (e.g. also business objects) can be used.

As a rule, however, dictionaries are created by Grouping or Indexing.

The access to a dictionary takes place over the [...] operator. Here the key is written into the square brackets, whose value one would like. The result is then the value stored in the dictionary for this key.

$dict[$key]

Parameter

Name Type Description Mandatory Default
key Number/string/boolean/business object/set Key for a key-value pair. yes
value Number/string/boolean/business object/set Value for a key-value pair. yes

Return value

Type: Business object

A dictionary with the specified key-value pairs.

Examples

String dictionary

	{
  dict = {
    "all": "alle",
    "some": "manche",
    "none": "keine"
  };

  $dict["all"]
}

Output: all

Outputs the value for the key all.

Dictionary with a wide variety of key data types

	{
  dict = {
    list(1, 2): "List",
    2: "Number",
    date(2020, 5, 8): "Object"
  };

  list($dict[list(1, 2)], $dict[2], $dict[date(2020, 5, 8)])
}

Output: A list with the values ["List", "Number", "Object"].