Skip to content

Operators

Comparison operators live in nodes, not in expressions. The If node, the While node and the Switch node's value-mode rules compare two values with the operators below. Inside {{ }}, operators such as > or == are not evaluated.


Operator reference

Operator True when Works on
equal The two values are exactly equal Any
notEqual They are not exactly equal Any
greaterThan value1 > value2 Numbers, or text that reads as a number
lessThan value1 < value2 Numbers, or numeric text
greaterThanOrEqual value1 >= value2 Numbers, or numeric text
lessThanOrEqual value1 <= value2 Numbers, or numeric text
contains value1 contains value2 Text (substring) or a list (element)
notContains It doesn't Text or a list
startsWith / notStartsWith Prefix match, or not Text
endsWith / notEndsWith Suffix match, or not Text
regex value1 matches the pattern in value2 Text
isEmpty Empty text, list or object, or null Any (value2 ignored)
isNotEmpty The opposite of isEmpty Any
isNull / isNotNull The value is null, or not Any
isTrue Boolean true, or the text true (any case) Boolean or text
isFalse Boolean false, or the text false (any case) Boolean or text

The Switch node's rule builder offers equal, notEqual, contains, startsWith, endsWith and regex. The rest work if you set them in the node's JSON tab.


Mismatches fail the node

A comparison that doesn't make sense fails the node with a clear message. It does not quietly go down the false branch:

  • an unknown operator;
  • greaterThan and friends when either value isn't a number or numeric text;
  • startsWith, endsWith or regex when value1 isn't text, or contains when it isn't text or a list;
  • an invalid regex pattern.

equal, notEqual and the is… checks work on any value and never fail.


Values arrive as text

An operand written as a $ expression, such as {{ $trigger.payload.amount }}, resolves to text before the node compares it (see Syntax basics). That affects some operators:

  • Numeric operators convert numeric text, so {{ $trigger.payload.amount }} greaterThan 1000 works.
  • equal compares exactly. Compare text with text: {{ $input.status }} equal active.
  • A missing field arrives as the text null, so isNull and isEmpty are false for it. Check with equal and the value null, or test the field before it reaches the If.
  • isTrue and isFalse accept the text true and false, so they work on resolved booleans.

In the If node and the While node, a value written without a $ root, such as {{ status }}, is looked up in the current item and keeps its type. Prefer $input.status, which works in every field.


Combining conditions

If and While take a list of conditions and a combinator:

  • and: every condition must match.
  • or: at least one must match.

There is no nested grouping. For complex logic, chain If nodes, or compute a flag in a Set or Code node and test that.


Regex

regex tests whether the pattern matches anywhere in value1. Anchors are not added for you: foo matches fooBar; use ^foo$ for a whole-text match. Escape characters that are special in regex when you mean them literally: ., *, +, ?, [, ], (, ), ^, $, \, |.


Example: If with two conditions

Condition 1:
  value1:   {{ $trigger.payload.amount }}
  operator: greaterThan
  value2:   1000

Condition 2:
  value1:   {{ $trigger.payload.country }}
  operator: equal
  value2:   US

Combinator: and

Connect the If's true port to the high-value US order path and false to the regular path.


Example: Switch in value mode

rules:
  - { value1: eventType, operator: startsWith, value2: order.,       output: orders }
  - { value1: eventType, operator: startsWith, value2: refund.,      output: refunds }
  - { value1: eventType, operator: equal,      value2: user.created, output: signup }
defaultOutput: other

In Switch rules, value1 is a field path in the incoming item, not an expression.


Where == and && do work

Workflows built by the AI builder can give a node a run condition: the node runs only when the condition is true, and is otherwise recorded as skipped. In a run condition, the {{ }} blocks are resolved first, then ==, !=, <, >, <=, >=, &&, || and ! are applied:

{{ $input.status }} == "active" && {{ $input.amount }} > 100

A condition that can't be evaluated counts as false.



Found something out of date? This page lives in the Flero docs content set.