All nodes/Data/Values & State
Set Variable
Writes a new value to a variable (Var node). The «Input» port is the execution trigger and the data to write; «Var» is the reference to the Var node.
Type in the graph: var_set
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
A message counter for the thread
The variable is read, incremented by one and written back.
- Execute + Data
- Data
Runs as pasted
When to use it
This is the only way to write a variable with wires on the canvas. The split is simple: Variable declares the name, type and storage scope and reads the value; this node writes it. The second writing path is the JavaScript Code node — it sees the declared variables and hands changed values back.
If the value never changes, you do not need a variable at all — use a Constant.
How it works
The “Var” port takes an edge from a Var node. That edge carries a reference — the variable’s name, type and scope — not its value: this is how the node learns where to write. The “Input” port plays two roles at once: it triggers the step and it carries the value to write.
The written value leaves through the “Value” output, while a separate “Success” output continues the chain of steps.
Before the write the value is coerced to the type the Var node declares. That matters because the usual writer upstream is Template, and a template always returns text: without coercion the string “1” would land in an integer variable and break the next comparison. A value that cannot be coerced is stored as it is.
Common mistakes
- An unconnected “Var” port blocks the deploy. The validator reports that the node has no source for its target variable — advice in the editor, a hard error at deploy and run.
- The Call scope stores nothing. A variable declared with that scope is ephemeral by design, and the write is simply dropped.
- An empty value is not the old value. An empty string or a missing value is coerced to
the type’s zero:
0,false, an empty object. - Read order decides everything. A branch running in parallel with the write may read the old value; to read the new one, put the consumer downstream in the chain of steps.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Inputinput | Execute + Dataexecute_data | — | Run trigger and value to write |
Varvar | Datadata | — | Connect a Var node here |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Valueoutput | Datadata | object |
Configuration
This node has no configurable fields.
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.