Skip to main content

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: 0 is false, all others true
    • Strings: Empty string "" is false, all others true
    • Objects/Arrays: Always true (including empty objects/arrays)
    • null and undefined: False

Inputs

InputTypeDescriptionDefault
RunEventTriggers the condition evaluation-
TestDataThe condition to evaluate. Can be any data type (boolean, number, string, object, etc.)-

Outputs

OutputTypeDescription
TrueEventFires when the test condition evaluates to true/truthy
FalseEventFires 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:

  1. If the condition is truthy (or specifically the string "true"), the True event fires
  2. If the condition is falsy (including the strings "false", "null", or "undefined"), the False event 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, the True event fires
  • If the boolean is false, the False event fires

String Comparison

When checking string values:

  • The string "true"True event fires
  • The string "false"False event fires (special handling)
  • The string "yes"True event fires
  • Empty string ""False event fires

Number Check

  • Number 1 or any non-zero number → True event fires
  • Number 0False event fires

Null/Undefined Handling

  • null or undefined values → False event fires
  • The string "null" or "undefined"False event 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.