Skip to main content

Conditional

Tests the value and runs one of two lists of transforms on it, Then or Else, depending on the result. The value is always the left side of the test, and Compare To, where the condition takes one, is the right. It is how one mapping produces one of two values, such as Published or Draft from a status, without a Script and without a branch in the flow.

note

A Conditional transform changes a value. A Condition node changes which path the flow takes. Reach for the transform when the steps stay the same and only a value differs.

The Conditional reference describes each field, in the same words its Guide icon shows in the tool.

The conditions​

The two-value conditions compare the value with Compare To: Equals (==), Not Equals (!=), Greater Than (>), Less Than (<), Greater Or Equal (>=), Less Or Equal (<=), Contains and Matches Regex. The one-value conditions test the value alone and hide Compare To: Is Empty, Is Not Empty, Is Truthy and Is Not Truthy.

They are the same comparisons the Expression condition offers, read the same way. What each one compares, and what counts as empty or truthy, is defined once under the Expression condition's comparisons.

Then and Else​

Each branch is a list of transforms, run in order on the value as it arrived, each one working on what the one before it produced, exactly as the mapping's own list does. A branch with no transforms passes the value on unchanged, so a Conditional with only a Then list changes the value when the condition holds and leaves it alone otherwise. A Conditional can hold another Conditional, in either branch, for a test with more than two outcomes.

Set Value is what gives a branch something to produce: a Conditional that tests whether the value equals done can hold a Set Value of Published under Then and one of Draft under Else. For a default where nothing came through, Set Value's Only When Empty does the job on its own, with no Conditional.

In a run, the mapping's trace shows the condition and what it compared to, the branch the Conditional took, and that branch's transforms nested beneath it, each with what it produced.

A step in a run, one of its input mappings opened to its trace: the source, then a Conditional's Then branch and the Set Value in it

What later steps see​

The variable picker shows the mapping with the type its source and transforms can state. A Conditional's two branches can produce different types, so the mapping has a type only when both state the same one, such as two branches that each end in a Convert to Number. A Set Value states none, so a Conditional whose branches are Set Values is offered without a type, and later steps take its value whole.

  • Expression: the condition node that routes the flow with the same comparisons.
  • List: Filter, which tests each item of a list with the same conditions.
  • Set Value: the value each branch produces.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.