ComfyUI Node

Switch Case

Pick one of up to eight inputs by index — and only that one runs

By creativeself-kim·Created 10 months ago·Updated 6 months ago· 1
Switch Case
  • input_0
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • input_6
  • input_7
  • output
count3
select0

A binary switch covers two options. Real workflows often need more - three prompt strategies, five reference images, a handful of alternate models to route into one sampler. UtilSwitchCase is the multi-way version: a select index that picks one of up to eight inputs, with the same lazy evaluation as its two-way sibling so only the chosen branch actually executes. It's the ComfyUI equivalent of a switch statement, minus the syntax.

How it works

A count field (2 to 8) controls how many input slots the node offers - the pack's JS grows and shrinks the node to match. A select index (0 to count-1) decides which one wins. The output is simply that input, passed through unchanged - which is possible because every input is ANY-typed, so you can switch on models, latents, images, conditioning, strings, anything.

The lazy part is the point, same as UtilSwitch: the node's check_lazy_status tells ComfyUI which single input it needs, so the other seven branches never execute. Route eight heavy pipelines through this and only one of them runs - the VRAM savings are exactly why you use it over chaining mutes.

The inputs and output

  • count (INT, default 3, 2–8) - how many slots to show.
  • select (INT, default 0, 0–7) - which slot to output.
  • input_0 through input_7 (ANY, lazy, optional) - the candidates.
  • output (ANY) - the selected value.

The index is clamped into range - select higher than count-1 silently picks the last valid slot rather than erroring - so an out-of-range value won't crash your graph, it'll just surprise you. Watch that.

Where it shines

Any place you find yourself stacking three-plus alternatives: a library of style LoRAs to pick from, several checkpoint paths, a set of prompt variants selected by an integer you can drive from another node. Because select is a normal input, it can be wired from upstream logic - a batch iteration, a random node, or a UI widget - turning this into a poor-man's loop indexer. Pair with the pack's UtilStringToList or SBConcatStrings to feed pre-built alternatives into the slots.

Install

Part of the IXIWORKS pack - ComfyUI Manager → search ComfyUI-VideoDescription → Install, restart, or clone into custom_nodes/. No extra dependencies. The dynamic slot count is a web-UI feature like the pack's other JS nodes - save workflows from the UI, or the slot count on reload won't match what you built.

CategoryIXIWORKS/Utils

Inputs (10)

NameTypeDefaultDescription
countINT32–8
selectINT00–7
input_0opt*
input_1opt*
input_2opt*
input_3opt*
input_4opt*
input_5opt*
input_6opt*
input_7opt*

Outputs (1)

NameTypeDescription
output*