Dictionary package guide
Use Dictionary actions to store typed values under exact String keys and compare entries.
Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.
Prerequisites
You need no other application and no session. Create a Dictionary with String keys and typed values, or let Put fill an empty one. Examples start with $settings$={"a":"1"}, $first$={"a":"1","b":"2"} and $second$={"b":"9","c":"3"}. These values are Strings. Start again for each example.
After Put or Remove, set the output sourceMap to the same variable, or the change is lost. A String that holds JSON is not a Dictionary.
A missing key makes Get fail. Remove returns an empty String for it.
What you store and what you get back:
| You store | You get back |
|---|---|
| String, Number, Boolean, List, Dictionary | the same type |
| Datetime | text such as 2024-03-15 |
| File, or Any that holds text | String |
| Record, Table, Credential, Window | Dictionary |
| empty (JSON null) | the text null |
Get a stored date into a String or Any variable, then convert it. See Get.
Shared fields
Fill required fields. Blank optional fields use their defaults. Other modes' fields are ignored, but all filled fields must have valid types and formats. Choices ignore case. Bind outputs to their type, or Any to Any or a matching type. Use another output variable to keep the input unchanged.
Dictionary: pick a Dictionary variable such as $settings$, or type a valid JSON object. Keys are exact text: Name and name are two keys. Values follow the table in Prerequisites.
Key: type text or pick a String variable.
Two dictionaries
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
first | First dictionary | Dictionarydefault {}required | First Dictionary. Its key order comes first. |
second | Second dictionary | Dictionarydefault {}required | Second Dictionary. |
Entry fields
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
source | Dictionary variable | Dictionarydefault {}required | Dictionary. |
key | Key | Stringdefault ""required | Key. |
Actions
Assign (dictionaryAssign)
Copy all entries. Value types stay the same.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
source | Select the source dictionary variable | Dictionarydefault {}required | Dictionary. |
Outputs
| Output | Type | Meaning |
|---|---|---|
destination | Dictionary | The copy. |
Example
Set sourceDictionary=$settings$. Bind destinationDictionary to $copy$.
Expected result
$copy$ is {"a":"1"}. Empty input gives {}.
Find common keys (dictionaryFindCommonKeys)
Find keys in both dictionaries, regardless of values.
Inputs
Uses the two dictionaries.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | List | Common String keys in first-Dictionary order. |
Example
Set firstDict=$first$ and secondDict=$second$. Bind result to $keys$.
Expected result
$keys$ is ["b"], even though the values of b differ. No common keys gives [].
Find uncommon keys (dictionaryFindUncommonKeys)
Find keys in only one of the two dictionaries.
Inputs
Uses the two dictionaries.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | List | Keys only in the first, then keys only in the second, each in its own order. |
Example
Set firstDict=$first$ and secondDict=$second$. Bind result to $keys$.
Expected result
$keys$ is ["a","c"]. The common key b is left out, even though its values differ. Equal key sets give [].
Get (dictionaryGet)
Read one key's value. A missing key fails.
Inputs
Uses the entry fields.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | Any | The stored value, with the type from Prerequisites. A stored date comes back as a String. |
Example
Set sourceMap=$settings$ and key=a. Bind result to $value$.
Expected result
$value$ is the String 1. Key A fails because it is not there. When a key can be missing, check it first with Dictionary has key.
Read a stored date. Its text has seven decimal places. To convert it:
- Create an empty Dictionary
$dates$. In Put, setsourceMap=$dates$,key=due,varOrManual=Manual,subtype=DatetimeanddateVal=2024-03-15T10:30:00+00:00. BindsourceMapto$dates$. - In Get, set
sourceMap=$dates$andkey=due. Bindresultto the String$dateText$. It holds2024-03-15T10:30:00.0000000+00:00. - In Date and time Assign, set
option=constant,source=$dateText$,formatType=customandcustomFormat=yyyy-MM-dd'T'HH:mm:ss.SSSSSSSXXX. Bindresultto the Datetime$due$. It is2024-03-15T10:30:00+00:00.
Get keys as list (dictionaryGetKeysAsList)
List all keys for a loop.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
dictionary | Dictionary | Dictionarydefault {}required | Dictionary. |
Outputs
| Output | Type | Meaning |
|---|---|---|
result | List | The String keys, in Dictionary order. |
Example
Add String b=2 to $settings$. Set dictionary=$settings$. Bind result to $keys$.
Expected result
$keys$ is ["a","b"]. Empty input gives [].
Get values as list (dictionaryGetValuesAsList)
List all values in key order. Duplicates and value types stay.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
dictionary | Dictionary | Dictionarydefault {}required | Dictionary. |
Outputs
| Output | Type | Meaning |
|---|---|---|
result | List | The values, in the same order as Get keys as list for the same Dictionary. |
Example
Add String b=2 to $settings$. Set dictionary=$settings$. Bind result to $values$.
Expected result
$values$ is ["1","2"]. They are Strings because the stored values are Strings. Empty input gives [].
Merge dictionary (dictionaryMerge)
Merge all entries. For a key in both, the value from the second Dictionary wins.
Inputs
Uses the two dictionaries.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | Dictionary | A merged copy. The inputs do not change. |
Example
Set firstDict=$first$ and secondDict=$second$. Bind result to $merged$.
Expected result
$merged$ is {"a":"1","b":"9","c":"3"}. Keys that differ only in case stay separate. Two empty inputs give {}.
Put (dictionaryPut)
Add an entry or replace its value. Get the old value back.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
var | varOrManual | Vardefault Manualoptional | Manual: type a value of the subtype type. Variable: use new and ignore the manual value fields. |
subtype | Value type | Subtypedefault Stringoptional | For Manual: String uses string, Number uses num, Boolean uses bool, Datetime uses date. |
string | Value | Stringdefault ""optional | Manual and String: text. Empty is allowed. |
bool | Value | Booleandefault falseoptional | Manual and Boolean: true, false or a Boolean variable. |
num | Value | Numberdefault 0optional | Manual and Number: a number with . as the decimal point, or a Number variable. |
date | Value | Datetimedefault 0001-01-01T00:00:00+00:00optional | Manual and Datetime: a Datetime variable or a date with a time zone, such as 2024-03-15. It is stored and read back as text. See Get. |
new | Value | Anydefault ""optional | Variable: if you pick a variable such as $name$, Put keeps its type. Typed text is stored as text. |
Uses the entry fields.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | Any | The old value with its type. An empty String for a new key. |
source | Dictionary | The changed Dictionary. |
Example
Set sourceMap=$settings$, key=b, varOrManual=Manual, subtype=Number and numVal=5. Bind result to $previous$ and sourceMap to $settings$.
Expected result
$settings$ is {"a":"1","b":5}, and $previous$ is an empty String. A second Put for b returns the Number 5 and then replaces it.
Remove (dictionaryRemove)
Delete an entry and get its value back.
Inputs
Uses the entry fields.
Outputs
| Output | Type | Meaning |
|---|---|---|
result | Any | The removed value with its type. An empty String if the key is not there. |
source | Dictionary | The Dictionary after the removal. |
Example
Set sourceMap=$settings$ and key=a. Bind result to $removed$ and sourceMap to $settings$.
Expected result
$removed$ is the String 1, and $settings$ is {}. A missing key returns an empty String and does not change the Dictionary.
Size (dictionarySize)
Count the entries.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
source | Dictionary variable | Dictionarydefault {}required | Dictionary. |
Outputs
| Output | Type | Meaning |
|---|---|---|
size | Number | The number of keys. |
Example
Add String b=2 to $settings$. Set sourceMap=$settings$. Bind size to $count$.
Expected result
$count$ is the Number 2. Empty input gives 0.
Conditions
Each condition returns true or false for an If or Loop step. It has no outputs.
Dictionary has key (dictionaryKeyExists)
Check for an exact key. A key with an empty value counts.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
variable | Dictionary variable(contains key) | Dictionarydefault {}required | Dictionary. |
key | Key | Stringdefault ""required | Key. |
Outputs
No outputs. See Conditions.
Example
In an If, set variable=$settings$ and key=a.
Expected result
true. Key A gives false. Empty input gives false.
Dictionary value for key (dictionaryValueExistsForKey)
Compare the value of a key. A missing key or a value that cannot be compared gives false.
Inputs
| Field ID | Name in editor | Type; required; default | Use |
|---|---|---|---|
dictionary | Dictionary variable | Dictionarydefault {}required | Dictionary. |
key | Key | Stringdefault ""required | Key. |
value | Dictionary type | Valuedefault Stringoptional | How to compare: String as text (case matters), Number as a number (1.5), Boolean as true or false (lower case, spaces trimmed), Datetime as a date (no time zone means UTC). |
operator | Operator | Comparedefault EQoptional | EQ, NEQ, GT, GTE, LT, LTE mean =, ≠, >, ≥, <, ≤. INCLUDE checks that the value contains the target text; NOTINCLUDE checks that it does not. These two always compare text, case matters, and they ignore value. For Boolean, only EQ and NEQ can be true. |
value | Target value | Stringdefault ""optional | The target as text, for every type: 1, true or 2024-03-15. Convert a typed variable to String first. |
Outputs
No outputs. See Conditions.
Example
Set dictionary=$settings$, key=a, valueType=Number, operator=GTE and value=1.
Expected result
true. operator=LT gives false. A missing key or invalid typed value gives false, even with NEQ. Boolean ordered comparisons also give false. An empty target is contained in every value.