If
Controlled node
Overview
The If node is a fundamental control flow node that evaluates a condition and routes execution down one of two paths based on the result. It takes a single input value (the condition), evaluates its truthiness, and fires either the true or false event accordingly.
The node uses JavaScript truthiness rules with one important exception: the strings "false", "undefined", and "null" (case-insensitive) are treated as falsy values, even though they would normally be truthy in standard JavaScript.
Condition Evaluation
The node evaluates the test input using the following logic:
- If the value is a string equal to
"false","undefined", or"null"(ignoring case and whitespace), it is treated as false - Otherwise, standard JavaScript truthiness applies:
- Numbers:
0is false, all others true - Strings: Empty string
""is false, all others true - Objects/Arrays: Always true (including empty objects/arrays)
nullandundefined: False
- Numbers:
Inputs
| Input | Type | Description | Default |
|---|---|---|---|
| Run | Event | Triggers the condition evaluation | - |
| Test | Data | The condition to evaluate. Can be any data type (boolean, number, string, object, etc.) | - |
Outputs
| Output | Type | Description |
|---|---|---|
| True | Event | Fires when the test condition evaluates to true/truthy |
| False | Event | Fires when the test condition evaluates to false/falsy |
Runtime Behavior
When the Run event is received, the node immediately evaluates the Test input value. Based on the evaluation:
- If the condition is truthy (or specifically the string "true"), the
Trueevent fires - If the condition is falsy (including the strings "false", "null", or "undefined"), the
Falseevent fires
The node does not produce any data outputs - it only emits events to trigger downstream nodes.
Example Usage
Basic Boolean Check
Connect a boolean value to the Test input:
- If the boolean is
true, theTrueevent fires - If the boolean is
false, theFalseevent fires
String Comparison
When checking string values:
- The string
"true"→Trueevent fires - The string
"false"→Falseevent fires (special handling) - The string
"yes"→Trueevent fires - Empty string
""→Falseevent fires
Number Check
- Number
1or any non-zero number →Trueevent fires - Number
0→Falseevent fires
Null/Undefined Handling
nullorundefinedvalues →Falseevent fires- The string
"null"or"undefined"→Falseevent fires (special handling)
Workflow Example
[Start] → [If: Test = userInput]
├─ True → [Process Valid Input]
└─ False → [Show Error Message]
In this example, if userInput contains a valid value, processing continues. If it's empty, null, or the string "false", the error path is taken.