๐Ÿ‡ฌ๐Ÿ‡ง EN
๐Ÿ‡ฎ๐Ÿ‡น IT

๐Ÿ“Œ Set Variable

Creates or updates named workflow variables that persist across all subsequent steps in the run. Unlike step outputs โ€” which are written once and never change โ€” variables can be set and overwritten multiple times during a single execution.

Category: Data Manipulation  ยท  Type identifier: set_variable

Overview

Every step in a workflow produces output data, but that output is immutable: once written, it cannot be changed. Variables work differently. A variable is a named piece of data that any step can write and any later step can read. You can initialise a variable to zero, increment it inside a loop, and read the final value after the loop ends โ€” all using separate nodes.

The Set Variable node lets you define one or more variables in a single step. Each variable has a name, a type, and a value. The value can be a static literal or a {{ variable }} reference that pulls from a previous step's output.

Step output vs variable. A step's output (e.g. {{ fetch.output.status }}) is always the data returned by that exact step and never changes. A variable (e.g. {{ my_counter }}) is a shared slot that can be overwritten as many times as needed. Use variables for values that evolve during execution.

Configuration

The Set Variable node accepts an array of variable definitions. Add as many as you need in a single node rather than stacking multiple Set Variable nodes.

Sub-field Status Description
Name Required The variable name. Use lowercase letters and underscores (e.g. email_count). The variable is then referenced throughout the workflow as {{ email_count }}.
Type Required The data type of the variable. Choose one of:
string โ€” text
number โ€” integer or decimal
boolean โ€” true or false
array โ€” a list of values
object โ€” a key-value map
Value Required The initial value. Can be a static literal or a {{ variable }} reference pointing to a previous step's output. For type number, entering 0 initialises a counter. For type array, entering [] creates an empty list.

Output Data

All variables set by this node are available immediately in subsequent steps. Access them directly by name, without a step key prefix:

// Variables set by a Set Variable node are global to the run {{ email_count }} {{ result_summary }} {{ is_eligible }} // You can also access them via the step's output object {{ init_vars.output.email_count }} {{ init_vars.output.result_summary }}

Example Usage

Initialise a counter before a loop

You are looping over a list of orders and want to count how many are above a certain value.

  1. Add a Set Variable node (step key: init_vars) before the Loop node. Define one variable:
    Name: high_value_count Type: number Value: 0
  2. Inside the loop, add a Logic Gate that checks whether {{ loop_step.current_item.total }} is greater than 100.
  3. On the true branch, add a Counter node that increments high_value_count by 1.
  4. After the loop, reference the final count:
    Found {{ high_value_count }} high-value orders out of {{ loop_step.output.count }} total.

Build a result object across steps

// Set an initial object variable Name: report Type: object Value: {} // Later steps can reference and build on it {{ report }}

Tips & Notes

Related Nodes