Skip to main content
Version: Current

Collect

Mode: Request-Response

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:

  • as the result of the execution of the for-each node,
  • if split node is used

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

NameDescription
Values to collectDefined per incoming branch; for each record arriving from the given branch, its value is evaluated and 'collected' into the resulting list.
Output variable nameName 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 is Element.
  • The subsequent variable node defines elementSize variable; #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 #elementSize records.
  • 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)