Skip to content

Lazy Conditional

Evaluates up to 10 boolean conditions in order and returns the first corresponding value whose condition is true. It is lazy: only the value for the first true condition (or the else value) is computed/requested; all other branches are not evaluated.
Preview

Usage

Use this node to select among multiple alternative inputs based on boolean conditions without incurring the cost of computing all branches. Connect condition1/value1 for the highest-priority branch, followed by condition2/value2, and so on. If no conditions are true, the node outputs the 'else' input if provided.

Inputs

FieldRequiredTypeDescriptionExample
value1FalseWILDCARDValue to output if condition1 is true. Evaluated lazily only when condition1 is true.any supported type (e.g., text, image, number, dict)
condition1FalseBOOLEANFirst condition tested. If true, value1 is selected.true
value2FalseWILDCARDValue to output if condition2 is true and condition1 was false.any supported type
condition2FalseBOOLEANSecond condition tested, after condition1.false
value3FalseWILDCARDValue to output if condition3 is true and all prior conditions were false.any supported type
condition3FalseBOOLEANThird condition tested.true
value4FalseWILDCARDValue to output if condition4 is true and all prior conditions were false.any supported type
condition4FalseBOOLEANFourth condition tested.false
value5FalseWILDCARDValue to output if condition5 is true and all prior conditions were false.any supported type
condition5FalseBOOLEANFifth condition tested.false
value6FalseWILDCARDValue to output if condition6 is true and all prior conditions were false.any supported type
condition6FalseBOOLEANSixth condition tested.false
value7FalseWILDCARDValue to output if condition7 is true and all prior conditions were false.any supported type
condition7FalseBOOLEANSeventh condition tested.false
value8FalseWILDCARDValue to output if condition8 is true and all prior conditions were false.any supported type
condition8FalseBOOLEANEighth condition tested.false
value9FalseWILDCARDValue to output if condition9 is true and all prior conditions were false.any supported type
condition9FalseBOOLEANNinth condition tested.false
value10FalseWILDCARDValue to output if condition10 is true and all prior conditions were false.any supported type
condition10FalseBOOLEANTenth condition tested.false
elseFalseWILDCARDFallback value if none of the conditions are true. Evaluated only if reached.any supported type

Outputs

FieldTypeDescriptionExample
valueWILDCARDThe selected value from the first true condition, or the 'else' value if no conditions are true.the chosen branch output (e.g., an image, text, number, or object)

Important Notes

  • Order matters: Conditions are evaluated from condition1 to condition10; the first true condition wins.
  • Lazy evaluation: Only the selected branch's value (or 'else') is computed. Unselected branches are not executed.
  • Up to 10 branches: Supports at most 10 condition/value pairs.
  • Boolean inputs: Each condition input must be provided for correct evaluation. The node may request missing conditions when needed.
  • Type consistency downstream: The output type is WILDCARD; ensure downstream nodes can handle the type from whichever branch is selected.
  • Fallback behavior: If no condition is true and 'else' is not connected, the output will be null/empty.

Troubleshooting

  • No output produced: If the result is null, ensure at least one condition is true or connect the 'else' input.
  • Unexpected branch selected: Verify the boolean values and remember that evaluation stops at the first true condition.
  • Downstream type errors: Align the types of all possible branch outputs to what downstream nodes expect.
  • Performance not improved: Confirm heavy computations are placed in branch values and that only the intended condition triggers them.
  • Missing input requested: If the node asks for a specific condition or value, connect that input; the node requests only what is required for the chosen path.