Block Assign Value to Outputs

The Assign Value to Outputs block is a block that can only be used in subflows to set the value of an output.

When inserted in a Sub Flow, where there is at least one output, the block will be rendered as follows:

If the block is used a flow will be displayed as follows:

Example of “Assign Value to Outputs” Block configuration

Suppose you want to create a subflow that takes care of incrementing an integer variable passed in input to the subflow itself.

To do this we are going to create a new Sub flow whose “INPUTS & OUTPUTS” section will be configured as follows:

Now Let’s add a “Script” block configured as imagined here:

In the “Expression (Script)” section we will then insert the following code:

$input = $tis->getInput('input');
$increase = $tis->getInput('increase');

$this->setOutput('output',$input+$increase

After the script block, We will have to go to include the block “Assign Value to Outputs” and we will configure it to set in the output “output” the value increased by the script:

Finally we will have to activate the SubFlow to make it available to flows.