Dictionary Contains Key
Dictionary Contains Key
Section titled “Dictionary Contains Key”Type: dict-contains-key · Package: Collections Activities v1.0.3 · Output: bool
Checks whether a dictionary contains a key and returns true/false. Use it before reading a value with Get Dictionary Value, which fails if the key does not exist.
How it works
Section titled “How it works”Checks whether the key exists in dict. The key is converted to text before looking it up. In dictionaries created with Create Dictionary or newDict(), keys are case-sensitive ("Total" and "total" are different keys). It does not modify the dictionary.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
dict | Dictionary | — | The dictionary. |
key | string | — | The key to check. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a bool: true if the key exists (even if its value is null), false otherwise.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'dict' must be a Dictionary, got …. | dict is not a dictionary (the message shows the type received, or null if the variable is empty). Create it first with Create Dictionary. |
'key' cannot be null. | The key expression returned null. |
Example
Section titled “Example”Fill in a default value when it is missing from the configuration:
Dictionary Contains Key dict = config key = "timeout" → output: hasItIf condition = !hasIt └─ then: Set Dictionary Value dict = config key = "timeout" value = 30000 // default valueRelated activities
Section titled “Related activities”- Get Dictionary Value — read the value once the key is confirmed.
- Set Dictionary Value — assign a value.