Skip to main content

If

Controlled node

Overview​

Choose between two execution paths using a condition.

If chooses one of two event paths based on test. Use it after Compare to make a decision such as whether a score meets a threshold.

Inputs​

InputTypeDescription
runEventEvaluates the condition.
testDataThe value to check. A boolean from Compare is usually the clearest choice.

Outputs​

OutputTypeDescription
trueEventFires when the condition is treated as true.
falseEventFires when the condition is treated as false.

Only one of these outputs fires per evaluation. If does not output data; connect the original data source to any downstream nodes that need it.

How values are interpreted​

  • Boolean false, number 0, an empty string, null and a missing value take the false path.
  • The text values "false", "null" and "undefined" also take the false path, ignoring case and surrounding spaces.
  • Non-empty text otherwise takes the true path, including "0" and text containing only spaces.
  • Lists and objects take the true path, even when empty or containing an error field.

An If node does not validate a record or detect errors automatically. Use Length to check whether a list has items, or Assert to check an error result.

Example​

  1. Set Compare's operation to a >= b, with the score connected to a and a Number value of 70 connected to b.
  2. Connect Compare's result to If's test.
  3. Trigger If through run.
  4. Connect true to the passing action and false to the alternative action.