Skip to content
Get on GitHub Autodesk App Store - coming soon

Dictionary

17 nodes. Types ending in [] are lists. An input with a default is optional.

Nodes

Dictionary.ByKeysValues

Creates a dictionary from a list of keys and a list of values of the same length.

Inputs

Input Type Default What it does
keys required any[] — The keys (converted to strings).
values required any[] — The values, one per key.

Outputs

Output Type What it gives
dictionary dict The new dictionary.

Tags: map hash keyvalue

Dictionary.ContainsKey

Tests whether a dictionary has the given key (case-sensitive). A list of dictionaries and a list of keys on separate inputs pair up item by item and stop at the shorter list (the default Shortest lacing); set Cross-Product lacing (right-click the node) to use every key with every dictionary.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to look in.
key required string — The key to look for.

Outputs

Output Type What it gives
hasKey boolean True when the dictionary has the key.

Tags: has exists key lookup contains map

Dictionary.Count

Returns the number of entries in a dictionary.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to measure.

Outputs

Output Type What it gives
count integer The number of keys.

Tags: size length number entries keys map

Dictionary.FromRows

Builds a dictionary from a list of [key, value] rows (a later row wins for a repeated key).

Inputs

Input Type Default What it does
rows required any[] — A list of rows, each a list with the key in cell 0 and the value in cell 1.

Outputs

Output Type What it gives
dictionary dict The new dictionary.

Tags: pairs table rows keyvalue create columns map

Dictionary.Invert

Swaps keys and values into a new dictionary (values become text keys; for equal values the last entry wins).

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to invert.

Outputs

Output Type What it gives
dictionary dict A new dictionary from value text to the old key.

Tags: reverse swap flip reverse lookup map

Dictionary.Keys

Returns all keys of a dictionary as a list.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to read from.

Outputs

Output Type What it gives
keys string[] The keys as a list of strings.

Tags: names fields map

Dictionary.Merge

Combines several dictionaries into a new one; for a repeated key the later dictionary wins.

Inputs

Input Type Default What it does
dictionaries any number of wires required any[] — The dictionaries to combine, earliest first.

Outputs

Output Type What it gives
dictionary dict A new dictionary with the keys of all of them.

Tags: combine join union overlay update defaults map

Dictionary.RemoveKey

Returns a copy of the dictionary without the given key (a missing key is fine). A list of dictionaries and a list of keys on separate inputs pair up item by item and stop at the shorter list (the default Shortest lacing); set Cross-Product lacing (right-click the node) to use every key with every dictionary. To leave out several keys of one dictionary use Dictionary.RemoveKeys.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to copy.
key required string — The key to leave out.

Outputs

Output Type What it gives
dictionary dict A new dictionary without the key.

Tags: delete drop remove omit without map

Dictionary.RemoveKeys

Returns a copy of the dictionary without any of the listed keys (a key it does not have is fine). A list of keys gives one dictionary without all of them, unlike Dictionary.RemoveKey, which pairs a list of keys with a list of dictionaries. A list of dictionaries gives one result each; the key list applies to every one of them.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to copy.
keys required any[] — The keys to leave out (a single key works too). A key the dictionary does not have is fine.

Outputs

Output Type What it gives
dictionary dict A new dictionary without those keys.

Tags: delete drop remove omit without many map

Dictionary.SelectKeys

Returns a copy of the dictionary with only the listed keys, in the order they are listed (trim a property bag to the few keys a report needs). A key the dictionary does not have is left out. A list of dictionaries gives one trimmed dictionary each; the key list applies to every one of them.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to copy from.
keys required any[] — The keys to keep (a single key works too). A key the dictionary does not have is left out; a key listed twice is kept once.

Outputs

Output Type What it gives
dictionary dict A new dictionary with only those keys.

Tags: pick keep filter subset only columns fields map

Dictionary.SetValueAtKey

Returns a copy of the dictionary with the given key set or updated; the input dictionary is not changed. A list of dictionaries and a list of keys on separate inputs pair up item by item and stop at the shorter list (the default Shortest lacing); set Cross-Product lacing (right-click the node) to use every key with every dictionary. To set several keys at once use Dictionary.SetValues.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to copy.
key required string — The key to set.
value required any — The value to store under the key.

Outputs

Output Type What it gives
dictionary dict A new dictionary with the key set.

Tags: set update insert put map

Dictionary.SetValues

Returns a copy of the dictionary with several keys set or updated at once, from a list of keys and a list of values of the same length (the several-key version of Dictionary.SetValueAtKey). For a key listed twice the last value wins; the input dictionary is not changed. A list of dictionaries gives one result each; the keys and values apply to every one of them.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to copy.
keys required any[] — The keys to set or update (converted to text).
values required any[] — One value per key, in the same order.

Outputs

Output Type What it gives
dictionary dict A new dictionary with all the keys set; for a key listed twice the last value wins.

Tags: set update insert put many multiple map

Dictionary.ToRows

Converts a dictionary to a list of [key, value] rows.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to convert.

Outputs

Output Type What it gives
rows any[] A list of [key, value] rows; the key is text.

Tags: pairs table rows entries items keyvalue map

Dictionary.ValueAtKey

Returns the value stored under the given key; a missing key is an error (Dictionary.ValueOrDefault gives a fallback instead, Dictionary.ValueAtPath follows a path into nested data). A list of dictionaries and a list of keys on separate inputs pair up item by item and stop at the shorter list (the default Shortest lacing); set Cross-Product lacing (right-click the node) to use every key with every dictionary. To read several keys of one dictionary use Dictionary.SelectKeys.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to read from.
key required string — The key to look up.

Outputs

Output Type What it gives
value any The value stored under the key.

Tags: lookup get map

Dictionary.ValueAtPath

Follows a path into nested data (the result of JSON.Parse or XML.Parse) and returns what it finds there, or a default value when any step is missing. The steps are separated by / (or by . when the path has no /): a key (Project/Name), a position in a list (Tasks/Task/0/Name; -1 is the last item) or * for every item of a list (Tasks/Task/*/Name gives a list of names). A position of 0 or -1 also works on a value that is not a list, so the same path reads a file with one <Task> and a file with many. A list of paths gives one result per path.

Inputs

Input Type Default What it does
value required any — The dictionary (or list) to read from.
path required string — The steps to follow, separated by / (or by . when the path has no /): a key such as Project/Name, a list position such as Tasks/Task/0/Name (negative counts from the end), or * for every item of a list.
defaultValue any null Returned when any step of the path is missing (null when left unwired).

Outputs

Output Type What it gives
value any The value at the path, a list of the results when the path has a *, or the default.

Tags: path nested deep json xml get lookup navigate drill map

Dictionary.ValueOrDefault

Returns the value stored under a key, or a default value when the key is missing. A list of dictionaries and a list of keys on separate inputs pair up item by item and stop at the shorter list (the default Shortest lacing); set Cross-Product lacing (right-click the node) to use every key with every dictionary.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to read from.
key required string — The key to look up.
defaultValue any null Returned when the key is missing (null when left unwired).

Outputs

Output Type What it gives
value any The stored value, or the default.

Tags: get lookup fallback safe optional missing map

Dictionary.Values

Returns all values of a dictionary as a list.

Inputs

Input Type Default What it does
dictionary required IDictionary — The dictionary to read from.

Outputs

Output Type What it gives
values any[] The values as a list.

Tags: entries contents map