Collect
Description
It is possible that in the request - response scenario, multiple records start to "flow" through the scenario. This situation happens in the following cases:
In such cases, the collect node provides a convenient way of collecting records from these branches into a list. The collect node is a join - branches (e.g. created by the split node) are connected directly to it; no additional merging node is needed. All the 'data items' collected from the incoming branches have to be of the same data type.
Parameters and configuration
| Name | Description |
|---|---|
| Values to collect | Defined per incoming branch; for each record arriving from the given branch, its value is evaluated and 'collected' into the resulting list. |
| Output variable name | Name of the variable which will store a list of 'data items' collected from the branches. |
Example
- For-each node executes on a list
{"one", "two", "three"}, the output variable isElement. - The subsequent variable node defines
elementSizevariable;#Element.length(returns length of the string) is an expression defining this variable. Because this node is "after" the for-each node, it will execute as many times as there are elements in the list on which for-each node executed, producing 3#elementSizerecords. - Collect node is configured to collect
#elementSize'data item' (in this example there is only one branch entering collect node).
The output from collect node will be a list: {3, 3, 5}.
Additional considerations
Collect is designed to be used in simple collect cases, it might not work as expected in nested structures (like for-each inside for-each)