Skip to main content
Version: Current

Collect

Mode: Request-Response

Description

It is possible that in the request - response scenario, multiple data 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 data records in those branches into a list. Each branch can 'contribute' one 'data item' only and these 'data items' have to be of the same data type. Before data from from different branches can be 'collected',a union node should be used to merge the branches.

Parameters and configuration

NameDescription
Ouput expressionFor each branch, defines 'data item' to be 'collected' from the given branch.
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 data 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)