Skip to content

Map operator

Overview

The Map operator produces an object with as many keys as it has input variables.
Each key has the name of the input variable itself and as its value the output key of an upstream block that has been associated with the input variable by mapping.
For example, if the input variable A is mapped to the output key B of an upstream block, the output of Map will contain a key A whose value will be that of key B.

A Map block can be put downstream of any other block, but it is particularly useful at the end of a flow to easily produce an essential output, containing only what you want to come out from the workflow, so that the output JSON of the workflow itself is as compact and easy-to-parse as possible. For this reason, the Map operator is considered a post-processor in the workflow creation wizard.

Versions

There are two versions of the component available: 1.0.0 and 1.1.0. Version 1.0.0 is present for backward compatibility with old workflows created with previous versions of NL Flow. For new workflows always use the latest version.

Input

A Map block does not have any input variables by default, the designer creates them while defining the map.

Block properties

Block properties, which are accessed by editing the block in the workflow editor, are divided in two groups:

  1. Basic properties:

    • Block name
    • Component version (read only)
    • Block ID (read only)
  2. The map, that is the input variables mapped to the output keys of upstream blocks.
    To define the map, proceed as described in the article about creating input variables and setting corresponding input properties through mapping.

Output

The output of a Map block is a JSON object containing the results of the mapping. Its structure is as follows:

{
    First input variable: value of the corresponding output key of the upstream block
    Second input variable: value of the corresponding output key of the upstream block
    ...
    Last input variable: value of the corresponding output key of the upstream block
}

Info

If an input variable cannot be set when the workflow is executed because the corresponding source is missing, the output key will be set to null.