PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

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.

Jump to actions

Packages

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 storeYou get back
String, Number, Boolean, List, Dictionarythe same type
Datetimetext such as 2024-03-15T10:30:00.0000000+00:00
File, or Any that holds textString
Record, Table, Credential, WindowDictionary
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 IDName in editorType; required; defaultUse
firstDictFirst dictionaryDictionarydefault {}requiredFirst Dictionary. Its key order comes first.
secondDictSecond dictionaryDictionarydefault {}requiredSecond Dictionary.

Entry fields

Field IDName in editorType; required; defaultUse
sourceMapDictionary variableDictionarydefault {}requiredDictionary.
keyKeyStringdefault ""requiredKey.

Actions

Assign (dictionaryAssign)

Copy all entries. Value types stay the same.

Inputs

Field IDName in editorType; required; defaultUse
sourceDictionarySelect the source dictionary variableDictionarydefault {}requiredDictionary.

Outputs

OutputTypeMeaning
destinationDictionaryDictionaryThe copy.

Example

Set sourceDictionary=$settings$. Bind destinationDictionary to $copy$.

Expected result

$copy$ is {"a":"1"}. Empty input gives {}.

Back to actions

Find common keys (dictionaryFindCommonKeys)

Find keys in both dictionaries, regardless of values.

Inputs

Uses the two dictionaries.

Outputs

OutputTypeMeaning
resultListCommon 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 [].

Back to actions

Find uncommon keys (dictionaryFindUncommonKeys)

Find keys in only one of the two dictionaries.

Inputs

Uses the two dictionaries.

Outputs

OutputTypeMeaning
resultListKeys 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 [].

Back to actions

Get (dictionaryGet)

Read one key's value. A missing key fails.

Inputs

Uses the entry fields.

Outputs

OutputTypeMeaning
resultAnyThe 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:

  1. Create an empty Dictionary $dates$. In Put, set sourceMap=$dates$, key=due, varOrManual=Manual, subtype=Datetime and dateVal=2024-03-15T10:30:00+00:00. Bind sourceMap to $dates$.
  2. In Get, set sourceMap=$dates$ and key=due. Bind result to the String $dateText$. It holds 2024-03-15T10:30:00.0000000+00:00.
  3. In Date and time Assign, set option=constant, source=$dateText$, formatType=custom and customFormat=yyyy-MM-dd'T'HH:mm:ss.SSSSSSSXXX. Bind result to the Datetime $due$. It is 2024-03-15T10:30:00+00:00.

Back to actions

Get keys as list (dictionaryGetKeysAsList)

List all keys for a loop.

Inputs

Field IDName in editorType; required; defaultUse
dictionaryDictionaryDictionarydefault {}requiredDictionary.

Outputs

OutputTypeMeaning
resultListThe 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 [].

Back to actions

Get values as list (dictionaryGetValuesAsList)

List all values in key order. Duplicates and value types stay.

Inputs

Field IDName in editorType; required; defaultUse
dictionaryDictionaryDictionarydefault {}requiredDictionary.

Outputs

OutputTypeMeaning
resultListThe 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 [].

Back to actions

Merge dictionary (dictionaryMerge)

Merge all entries. For a key in both, the value from the second Dictionary wins.

Inputs

Uses the two dictionaries.

Outputs

OutputTypeMeaning
resultDictionaryA 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 {}.

Back to actions

Put (dictionaryPut)

Add an entry or replace its value. Get the old value back.

Inputs

Field IDName in editorType; required; defaultUse
varOrManualvarOrManualVarOrManualdefault ManualoptionalManual⁠: type a value of the subtype type. Variable⁠: use newValue and ignore the manual value fields.
subtypeValue typeSubtypedefault StringoptionalFor Manual⁠: String uses stringVal⁠, Number uses numVal⁠, Boolean uses boolVal⁠, Datetime uses dateVal⁠.
stringValValueStringdefault ""optionalManual and String⁠: text. Empty is allowed.
boolValValueBooleandefault falseoptionalManual and Boolean⁠: true⁠, false or a Boolean variable.
numValValueNumberdefault 0optionalManual and Number⁠: a number with . as the decimal point, or a Number variable.
dateValValueDatetimedefault 0001-01-01T00:00:00+00:00optionalManual and Datetime⁠: a Datetime variable or a date with a time zone, such as 2024-03-15T10:30:00+00:00⁠. It is stored and read back as text. See Get.
newValueValueAnydefault ""optionalVariable⁠: if you pick a variable such as $name$⁠, Put keeps its type. Typed text is stored as text.

Uses the entry fields.

Outputs

OutputTypeMeaning
resultAnyThe old value with its type. An empty String for a new key.
sourceMapDictionaryThe 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.

Back to actions

Remove (dictionaryRemove)

Delete an entry and get its value back.

Inputs

Uses the entry fields.

Outputs

OutputTypeMeaning
resultAnyThe removed value with its type. An empty String if the key is not there.
sourceMapDictionaryThe 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.

Back to actions

Size (dictionarySize)

Count the entries.

Inputs

Field IDName in editorType; required; defaultUse
sourceMapDictionary variableDictionarydefault {}requiredDictionary.

Outputs

OutputTypeMeaning
sizeNumberThe 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.

Back to actions

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 IDName in editorType; required; defaultUse
variableDictionary variable(contains key)Dictionarydefault {}requiredDictionary.
keyKeyStringdefault ""requiredKey.

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.

Back to conditions

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 IDName in editorType; required; defaultUse
dictionaryDictionary variableDictionarydefault {}requiredDictionary.
keyKeyStringdefault ""requiredKey.
valueTypeDictionary typeValueTypedefault StringoptionalHow 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).
operatorOperatorCompareOperatordefault EQoptionalEQ⁠, 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 valueType⁠. For Boolean, only EQ and NEQ can be true.
valueTarget valueStringdefault ""optionalThe target as text, for every type: 1⁠, true or 2024-03-15T10:30:00+00:00⁠. 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.

Back to conditions