reduce

This block is part of the foreach group and was last modified in core v10.4.28.

Type Selection Required

This block requires you to select the data type you want to work with. You must manually select the type using the type selector modal. To access the modal, click the white button on the block.

Field Selection Required

This block requires field selection (both). You must manually select the fields you want to work with using the field selector modal. To access the modal, click the white button on the block.

reduce v10.4.28

In pins 1 + flow
  • flow
    flow
  • Array required
    array
Out pins 1 + flow
  • done
    flow
  • Reducer
    execute_function

Folds the array into a single value: the accumulator starts from the block's dynamically-typed input pin, and after each iteration it is REPLACED by the iterator's return value (the last returned pin, or the exposed output when nothing is returned); the final accumulator is emitted on the same typed output. Iterations ALWAYS run serially : there is no concurrency pin. A failed iteration is skipped and keeps the previous accumulator. An empty or falsy array runs zero iterations and leaves the typed output unset (only exposed_data_output=[] is written).

A typical wiring for reduce: a function trigger starts the flow; the function out pin wires to an execute block.

Studio canvas example for the reduce block: typical wiring for reduce.

Version history

Introduced in v10.4.28.


Back to foreach Return to the main group to view all sub-groups Back to flow: loops Return to the group to view all blocks within this group