ComfyUI Node

Any Index

One integer picks which of fifteen branches actually runs

By wenchengxiang·Created 2 months ago·Updated 9 days ago· 3
Any Index
  • value_0
  • value_1
  • value_2
  • value_3
  • value_4
  • value_5
  • value_6
  • value_7
  • value_8
  • value_9
  • value_10
  • value_11
  • value_12
  • value_13
  • value_14
  • value
◄index0►

Any Index is a fifteen-way multiplexer: you wire up to fifteen values into value_0 through value_14, set one integer index, and the node passes through exactly the value you pointed at. It's the "choose one of these by number" node, and it's the explicit cousin of the Any Switch family in this pack - a switch walks its inputs and picks the first non-empty one automatically, while an index makes you choose.

The inputs that matter:

  • index - an INT from 0 to 14, default 0. This is your selector.
  • value_0 … value_14 - the fifteen candidates, all wildcard * type, all optional. Wire in only what you need.

Output is a single value - the content of whichever slot index points at, whatever its type was.

Here's the feature that makes it more than a glorified cable organizer, and it's worth reading carefully: the inputs are lazy. In the source each value_# is marked {"lazy": True} and the node declares which input it needs before executing. ComfyUI reads that and only evaluates the branch you actually selected. That means you can hang expensive upstream branches - three different model stacks, two ControlNet pipelines, a couple of alternative conditionings - off one index node, and only the chosen one computes. Unused branches aren't "cheap," they're not run at all. That's a genuinely useful trick for keeping several variants of a workflow in one graph.

Two behaviors to know:

  • If the selected slot isn't connected, you get None out. Fine for feeding an optional input downstream; just don't expect a default.
  • The widget enforces the 0–14 range, but a wired-in index doesn't. If you feed the index from another node and it lands outside the range, the lookup returns None rather than wrapping around.

Where it fits in the graph is the "graph as a small program" layer: an index is how you build a configurable workflow that other people can flip with a single number. Set it once, share the JSON, and the recipient picks variant 3 without untangling wires. That's the same niche the KB's node-plumbing doc describes for value and switch nodes - one authoritative source of choice instead of editing five places.

Install is pack standard: ComfyUI Manager → search ComfyUI-Practical-Tools → install → restart, or git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools into ComfyUI/custom_nodes. No dependencies, no models. If the output ever comes back None when you expected a value, check that the selected value_# is actually wired - that's the whole troubleshooting list.

CategoryPractical-Tools/utils

Inputs (16)

NameTypeDefaultDescription
indexINT00–14—
value_0opt*—
value_1opt*—
value_2opt*—
value_3opt*—
value_4opt*—
value_5opt*—
value_6opt*—
value_7opt*—
value_8opt*—
value_9opt*—
value_10opt*—
value_11opt*—
value_12opt*—
value_13opt*—
value_14opt*—

Outputs (1)

NameTypeDescription
value*—