Skip to content

Lazy Index Switch

Selects and forwards exactly one of up to ten inputs based on an integer index (0–9). Inputs are lazily evaluated: only the value corresponding to the selected index is requested/computed. This enables efficient branching without computing unused inputs.
Preview

Usage

Use when you need to route one of several possible values downstream based on a numeric selector. Typical in workflows where you predefine multiple alternatives (e.g., different prompts, images, or parameters) and choose one dynamically at run time. Connect any data type to value0..value9; set the index to pick which one is emitted.

Inputs

FieldRequiredTypeDescriptionExample
indexTrueINTZero-based selector for which input value to forward. Must be between 0 and 9.3
value0TrueWILDCARDCandidate value for index 0. Lazily evaluated; only needed if index is 0.First option
value1FalseWILDCARDCandidate value for index 1. Lazily evaluated; only needed if index is 1.Second option
value2FalseWILDCARDCandidate value for index 2. Lazily evaluated; only needed if index is 2.Third option
value3FalseWILDCARDCandidate value for index 3. Lazily evaluated; only needed if index is 3.Fourth option
value4FalseWILDCARDCandidate value for index 4. Lazily evaluated; only needed if index is 4.Fifth option
value5FalseWILDCARDCandidate value for index 5. Lazily evaluated; only needed if index is 5.Sixth option
value6FalseWILDCARDCandidate value for index 6. Lazily evaluated; only needed if index is 6.Seventh option
value7FalseWILDCARDCandidate value for index 7. Lazily evaluated; only needed if index is 7.Eighth option
value8FalseWILDCARDCandidate value for index 8. Lazily evaluated; only needed if index is 8.Ninth option
value9FalseWILDCARDCandidate value for index 9. Lazily evaluated; only needed if index is 9.Tenth option

Outputs

FieldTypeDescriptionExample
valueWILDCARDThe selected value corresponding to the provided index.Fourth option

Important Notes

  • Index range: Only indices 0–9 are supported.
  • Lazy evaluation: The node requests/computes only the input matching the selected index. Unselected inputs are not evaluated.
  • Provide the selected input: If the chosen index points to an unconnected/missing value input, the system will request it; if still missing at execution, the node outputs null.
  • Type-agnostic: The node passes through any type (WILDCARD). Ensure downstream nodes accept the selected value’s type.
  • No transformation: The node does not modify the selected value; it only routes it.

Troubleshooting

  • Nothing outputs: Verify that the value input matching the current index is connected. Connect valueN for the chosen index or change the index to one that is connected.
  • Type mismatch downstream: Ensure the downstream node can handle the data type of the selected value (e.g., IMAGE vs. STRING).
  • Unexpected null output: This occurs if the selected value input is missing or failed to load. Connect the input or change the index.
  • Cannot set index beyond 9: The node is limited to 0–9. Add another node or refactor branching if you need more options.