Skip to content

Simple Reducer

Overview

Simple Reducer is a reducer that produces a JSON containing an array whose items have properties taken from the outputs of the blocks of the reference context.

Input

Like any reducer, a Simple Reducer block has a virtual input made of the multiple outputs—one per iteration—of the blocks in the reference context. The parts of this input that must become properties of the items of the output array are established with a map defined in the Input tab of the block properties pop-up.

Block properties

The properties of a Simple Reducer block are accessed by editing the block and are divided into these groups:

  • Basic properties:

    • Block name
    • Component version (read only)
    • Block ID (read only)
  • Functional:

    • Field name for the array: name of the output array.
    • Context to reduce: reference context. It is chosen from a drop-down. To remove the choice, select Clear .
  • Deployment:

    • Timeout: execution timeout expressed in minutes (m) or seconds (s).
    • Replicas: number of required instances.
    • Consumer Number: number of threads of the consumer, the software module of the block that provides input to process by taking it from the block's work queue.
    • Memory: required memory.
    • CPU: thousandths of a CPU required (for example: 1000 = 1 CPU).
  • Input: the properties in this group define the source data and the name of the properties of each item of the output array.

    • To define a new property, in the Input tab of the properties pop-up:

      1. Click the plus button: a new row is added below the list of existing properties.
      2. In the left field enter the name of the property.
      3. Using the drop-down choose the corresponding key from the list of the output keys of the context blocks.

        First of all select the type of the property choosing between number, string, boolean, object and array. After that, the list below will only show output keys of the same type.

        The list is divided in groups, one group for each context block. Select the expand and collapse icons to the right of the block name or select the name of the block multiple times to show or hide the sub-list of output keys for that block.
        If the type of the property is object, the first entry in the sub-list is the block name.

        By choosing it, you indicate that the value of the property will coincide with the entire output JSON of that block.

        Note

        The drop-down list shows all the first-level keys that can, potentially, be available, but the keys that are actually there when executing the workflow may be less. If you map a key that's not actually produced at runtime, the corresponding output object will be set to null.

        To cancel the mapping process, select No mapping from the list or, if you already chose a key, select Clear .

    • To modify an existing property:

      • Edit the left field to change the name of the property.
      • Use the drop-down as described above to choose a different source.
    • To remove an existing property, select Remove to the right of it.

  • Output: read-only, this property is a navigable description of the structure of the output array.

Output

A Simple Reducer block produces a JSON object containing an array whose name is the value of the functional parameter Field name for the array (see in the block properties described above).
Each item of the array is an anonymous object with the properties defined in the the Input tab of the block properties pop-up. The structure of the array and its items can be seen in the Output tab of the same pop-up.