Skip to content

Define the input format

When:

  • A workflow has multiple independent data flows and the input JSON contains data for all of them, but one or more of the initial blocks, instead of picking only the data pertaining to it, crash due to the presence of data destined for other initial blocks.

or:

  • Some blocks deep in a workflow—that is, not at the beginning of a flow—need to tap directly into data contained in the workflow's input JSON.

or:

  • The first block of a data flow expects input keys that are equivalent to keys in the workflow input JSON, but have different names.

it is necessary to formally indicate the keys of interest contained in the input JSON. In this way, a pseudo block called $nlflow_input, virtually located upstream of the workflow and invisible in the diagram, is created and its "output" corresponds to the structure defined as the workflow's input.
The properties of this object can be referenced anywhere in the workflow with input mapping.

For example, in the case of two flows, one starting with a TikaTesseract Converter block and the other starting with a URL Converter block, an input JSON containing data for both is normally not allowed because the blocks reject a JSON object containing more properties than those they recognize: the workflow crashes.
In this case it is possible to define the input format by giving the virtual object $nlflow_input all the useful properties of the input JSON, then map the input properties of the TikaTesseract Converter and URL Converter blocks only to compatible properties of the $nlflow_input object.

To define the workflow input format, in the workflow editor, select Input format definition on the canvas toolbar. The Input format definition window appears.

Use the Basic tab to define the format interactively. In input format definition, Inputs correspond to top level properties of the workflow's input JSON.

  • To define a new top-level input key:

    • Select the plus button. A couple of boxes appears below the list. Enter the name of the new input key in the left box and click elsewhere, then select the type from the drop-down box on the right.

    Or:

    • Copy the name and the type from an input property of a block of the workflow:

      1. Select the block from the first drop-down menu on the right of the dialog's toolbar.
      2. Select an input property of the block from the second drop-down menu on the right of the dialog's toolbar.
  • To modify an input key change its name or type.

  • To delete an input key select it and then select Delete.

Alternatively, use the text editor in Advanced tab to define the format by writing a JSON template.
The entire template must be enclosed in curly braces.
The syntax of the definition for a input is:

"name": type

where name is the name of the input. type represents the type of the key and can be:

  • {} for an object
  • [] for an array
  • "" for a string
  • 0 for a number
  • false for a boolean

Use the comma , to separate multiple inputs.

  • To delete all the inputs select Clear text.
  • To save the definition select Save.