Item getter
[data/dictionary/Item getter]
Retrieves an item's value by its key from a dictionary.
If the item is not found, the inputs are sent via not found
.
Example A:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via
dict
"first"@0 received via
key
value
sends 1@0
Example B:
{ "first": 1, "third": 3, "fifth": 5 } @0 received via
dict
"second"@0 received via
key
not found
sends { "dict": { "first": 1, "third": 3, "fifth": 5 }, "key": "second" }@0
More: https://github.com/Cranq-io/cranq-tutorials/tree/main/reference/3_querying_data/3_1_getters
Keywords: dictionary, dict, get, value
Input ports
dict:
{string: any}
Receives the dictionary to get the value from. Example: { "first": 1, "third": 3, "fifth": 5 }
key:
string
Receives the key corresponding to the value to get. Example: "third"
Output ports
value:
{string: any}[string]
If found, sends the value corresponding to the specified key. Example: 1
not found:
{"dict": {string: any}, "key": string}
Sends the input values, when the specified key is not found in the dictionary. Example: { "dict": { "first": 1, "third": 3, "fifth": 5 }, "key": "second" }
Last updated