If

Use the If node to split a workflow conditionally based on comparison operations.

Add conditions

Add comparison conditions using the Add Condition filter. The available comparison operations vary for each data type.

String:

  • exists
  • doesn't exist
  • is equal to
  • isn't equal to
  • contains
  • doesn't contain
  • starts with
  • doesn't start with
  • ends with
  • doesn't end with
  • matches regex
  • doesn't match regex

Number:

  • exists
  • doesn't exist
  • is equal to
  • isn't equal to
  • is greater than
  • is less than
  • is greater than or equal
  • is less than or equal

Date & Time:

  • exists
  • doesn't exist
  • is equal to
  • isn't equal to
  • is after
  • is before
  • is after or equal
  • is before or equal

Boolean:

  • exists
  • doesn't exist
  • is true
  • is false
  • is equal to
  • isn't equal to

Array:

  • exists
  • doesn't exist
  • is equal to
  • isn't equal to
  • contains
  • doesn't contain
  • length equal to
  • length not equal to
  • length greater than
  • length less than
  • length greater than or equal
  • length less than or equal

Object:

  • exists
  • doesn't exist
  • is empty
  • isn't empty

AND / OR

If you have more than one condition, you can choose either:

  • AND : data must match all conditions to be true.
  • OR : data only needs to match one of the conditions to be true.

Branch execution with If and Merge nodes

If you add a Merge node to a workflow containing an If node, it can result in both output branches of the If node executing.

The Merge node is triggered by one branch, then goes and executes the other branch.

For example, in the screenshot below there's a workflow containing a Edit Fields node, If node, and Merge node. The standard If node behavior is to execute one branch (in the screenshot, this is the true output). However, due to the Merge node, both branches execute, despite the If node not sending any data down the false branch.

Related resources

Refer to Splitting with conditionals for more information on using conditionals to create complex logic in Mosaic Workflows.

If you need more than two conditional outputs, use the Switch node.