Skip to content

Lazy Index Switch

Selects and forwards exactly one of up to 10 candidate inputs based on an integer index, without evaluating the others. Inputs are lazily requested only when the chosen index requires them, helping avoid unnecessary computation. Returns the selected input value unchanged and preserves its data type.
Preview

Usage

Use this node to route a single value from multiple alternatives by index, especially when upstream branches are expensive to compute. Set the index to the desired branch (0–9); only that input will be resolved and passed downstream. Ideal for A/B testing, branching workflows, or selecting among preconfigured options without triggering all upstream work.

Inputs

FieldRequiredTypeDescriptionExample
indexTrueINTZero-based index of the input to forward. Must be between 0 and 9.2
value0TrueWILDCARDCandidate value at index 0. Lazily evaluated. Can be any supported type (e.g., IMAGE, MASK, STRING, NUMBER, MODEL, etc.).Any supported type value
value1FalseWILDCARDCandidate value at index 1. Lazily evaluated.Any supported type value
value2FalseWILDCARDCandidate value at index 2. Lazily evaluated.Any supported type value
value3FalseWILDCARDCandidate value at index 3. Lazily evaluated.Any supported type value
value4FalseWILDCARDCandidate value at index 4. Lazily evaluated.Any supported type value
value5FalseWILDCARDCandidate value at index 5. Lazily evaluated.Any supported type value
value6FalseWILDCARDCandidate value at index 6. Lazily evaluated.Any supported type value
value7FalseWILDCARDCandidate value at index 7. Lazily evaluated.Any supported type value
value8FalseWILDCARDCandidate value at index 8. Lazily evaluated.Any supported type value
value9FalseWILDCARDCandidate value at index 9. Lazily evaluated.Any supported type value

Outputs

FieldTypeDescriptionExample
valueWILDCARDThe value from the selected index, forwarded unchanged. Type matches the chosen input.Same type and content as the selected input (e.g., an IMAGE if an IMAGE input was selected)

Important Notes

  • Index must point to an input that is provided. Only value0 is required; value1–value9 are optional.
  • Only the selected input is evaluated/resolved; unselected inputs remain unevaluated.
  • If the selected input is missing or None, the node will output None.
  • The output type is the same as the selected input and may vary between runs based on the index.
  • Valid index range is 0–9; values outside this range are invalid.

Troubleshooting

  • Output is None: Ensure the index corresponds to a connected/provided valueN input.
  • Downstream type mismatch: Set the index to a branch whose type matches what downstream nodes expect.
  • Unexpected computation happening: Verify the index is fixed and not dynamically changing; only the chosen branch should be evaluated.
  • Index out of range error: Keep index between 0 and 9 and connect the corresponding valueN input.