Map array append

Maps Generic
Map array append
Map
Map
Key
Element

Description

Appends an element to the array stored under a key in a map of arrays, creating the array when the key is absent. The multimap primitive: wire it into a For each to group items by a shared value in one step. Mutates in place and returns the same map. Has execution pins (not pure).

When to use

Use Map array append as the multimap primitive — grouping items from an array by a shared field value in a single step. Wire it inside a For each loop over the source array: on each iteration, feed the item’s grouping field into Key and the item (or a derived value) into Element. The node creates an empty array the first time a key is seen, then appends into it, mutating the map in place and outputting the updated reference. The Map input specifically requires array values, so pair it with a local variable declared with the “Map of arrays” kind to hold the accumulator across iterations.

Pins

Input pins

Pin Type Default Notes
Map generic{generic[]} The map of arrays to append to. Unlike Map put, this pin specifically requires array values — the shape a local variable declared with the 'Map of arrays' kind holds. Key and element types resolve at design-time from the connected source.
Key generic The key whose array to append to. Must match the map's key type. The first time a key is seen, Map array append creates an empty array under it before appending.
Element generic The element to append to the array stored under the key. Must match the map's element type.

Output pins

Pin Type Notes
Map generic{generic[]} The same map after the element has been appended.

Execution pins

Pin Direction
In Input
Out Output

Example

Group a list of orders by customer ID inside a single For each loop. Wire the orders array into the Array input of For each, then inside the Loop body wire a local variable of kind “Map of arrays” into the Map input of Map array append, the order’s customer ID into Key, and the order itself into Element. Wire the output Map back into the local variable set so the grouped map carries forward to the next iteration. After the loop, the map holds every order grouped by customer ID — feed it into Map keys and For each to process each group.

See also