Skip to content

Condition

Branches execution into True or False based on one comparison.

@lainstack/flow/condition · Flow

Use this block to send the run down one of two paths from one typed comparison. It leaves on true or false, and the output matched holds the same answer. For many exact values use @lainstack/flow/switch. To stop the run on a mismatch use @lainstack/flow/assert. For several checks with a report use @lainstack/flow/checklist.

  • One block tests one comparison. Chain blocks to test more.
  • The operators depend on the value type, for example is_yes for yes or no, contains_item for lists, has_field for records, before and after for dates.
  • If an operand has no value, for example it refers to a block that did not run on this path, the step fails with comparison_invalid. It does not take false.
  • Text equality ignores letter case unless comparison.settings.matchCase is true. Outer spaces count unless comparison.settings.trim is outer.
  • Number and date equality accept comparison.settings.tolerance.
  • A Null comparison needs a reference or an explicit Null literal.
Setting Key Type Details
Value type comparison.kind One of Text, Number, Yes or no, Null, List, Record, Date, Date/time Default text.
Value comparison.left Text
Comparison comparison.operator One of Equals, Does not equal, Contains, Does not contain, Starts with, Ends with, Is empty, Is not empty, Greater than, Greater than or equal, Less than, Less than or equal, Is Yes, Is No, Is null, Is not null, Contains item, Does not contain item, Has field, Does not have field, Before, On or before, After, On or after
Compare with comparison.right Text
Output Path Type
Matched matched Yes or no
Exit Port Notes
True true
False false