Nodes/Quality of Life Nodes for ComfyUI/Any Enum Switch 10X (Soze)
ComfyUI Node

Any Enum Switch 10X (Soze)

A ten-case switch that keys on a string and spits out anything

By SozeInc·Created 2 years ago·Updated 8 days ago· 10
Any Enum Switch 10X (Soze)
  • default_value
  • any_value_1
  • any_value_2
  • any_value_3
  • any_value_4
  • any_value_5
  • any_value_6
  • any_value_7
  • any_value_8
  • any_value_9
  • any_value_10
  • matched_value
  • matched_index
  • matched
  • status
enum_value
case_sensitivefalse
strip_whitespacetrue
compare_text_1
compare_text_2
compare_text_3
compare_text_4
compare_text_5
compare_text_6
compare_text_7
compare_text_8
compare_text_9
compare_text_10

ComfyUI's switch nodes are usually either type-locked (this CONDITIONING mux only takes CONDITIONING) or so generic they get impossible to read. Any Enum Switch 10X takes a different approach: it's a plain string lookup table. Give it an enum_value, and it returns whichever of ten any-typed values matches the case label. One input drives the whole routing decision.

The mental model is a switch statement, not a mux. You decide the key, the node does the matching, and what it hands back can be a string, a number, a model, a conditioning - anything. That's the whole trick, and it's why this node shows up in batch workflows where a CSV column or a text input selects behavior per run.

How it works

The node compares enum_value against ten case labels (compare_text_1compare_text_10). On the first match it returns the corresponding any_value_N. No match? You get default_value. The matching defaults matter:

  • Case-insensitive by default (A == a), toggle case_sensitive if you care.
  • Whitespace is trimmed on both sides by default, so " happy " matches "happy". Toggle strip_whitespace off for exact matching.
  • Blank case labels are skipped, so an unconnected compare_text_N widget can't accidentally match a blank enum_value. This saves more confusion than you'd think.
  • First match wins - case 1 beats case 3 if both labels match.

Outputs: matched_value (the routed value), matched_index (1-based position, 0 when nothing matched), matched (a boolean you can feed into a logic check), and status (which tells you what matched, or that you got the default).

Where it earns its keep

Pair it with a CSV reader - pick a random style, subject or sampler name per run, and let this node route a prompt block or an enum value downstream. Or use it as a named preset switcher: enum_value says "cinematic", the node returns the full prompt/settings blob you stashed in any_value_3. Because the inputs are wildcards, the same node can route a MODEL, a string, or an int depending on what you wire in - you're not committing to a type at graph-build time.

Where people get burned: feeding in an enum_value that's actually a number while the labels are strings, or expecting a failed match to error out. It won't - it silently returns default_value with matched_index == 0. If you're relying on a match, check the boolean output before continuing downstream, or leave default_value empty and handle the blank.

Installing it

Same as any node in the Soze pack:

cd ComfyUI/custom_nodes
git clone https://github.com/SozeInc/ComfyUI_Soze.git
pip install -r ComfyUI_Soze/requirements.txt

Or search "ComfyUI_Soze" in ComfyUI Manager and restart. It's a pure-Python node - no API key, no model files, nothing extra to configure. Look for "Any Enum Switch 10X (Soze)" under the soze category in the node menu.

Categorysoze

Inputs (24)

NameTypeDefaultDescription
enum_valueSTRINGThe value to match against each compare_text_N.
default_valueopt*Returned when no compare_text_N matches.
case_sensitiveoptBOOLEANfalseIf True, 'A' != 'a'.
strip_whitespaceoptBOOLEANtrueIf True, surrounding whitespace is ignored on both sides.
compare_text_1optSTRINGCase 1 label. Blank means: skip this case.
any_value_1opt*Value returned when enum_value matches compare_text_1.
compare_text_2optSTRINGCase 2 label. Blank means: skip this case.
any_value_2opt*Value returned when enum_value matches compare_text_2.
compare_text_3optSTRINGCase 3 label. Blank means: skip this case.
any_value_3opt*Value returned when enum_value matches compare_text_3.
compare_text_4optSTRINGCase 4 label. Blank means: skip this case.
any_value_4opt*Value returned when enum_value matches compare_text_4.
compare_text_5optSTRINGCase 5 label. Blank means: skip this case.
any_value_5opt*Value returned when enum_value matches compare_text_5.
compare_text_6optSTRINGCase 6 label. Blank means: skip this case.
any_value_6opt*Value returned when enum_value matches compare_text_6.
compare_text_7optSTRINGCase 7 label. Blank means: skip this case.
any_value_7opt*Value returned when enum_value matches compare_text_7.
compare_text_8optSTRINGCase 8 label. Blank means: skip this case.
any_value_8opt*Value returned when enum_value matches compare_text_8.
compare_text_9optSTRINGCase 9 label. Blank means: skip this case.
any_value_9opt*Value returned when enum_value matches compare_text_9.
compare_text_10optSTRINGCase 10 label. Blank means: skip this case.
any_value_10opt*Value returned when enum_value matches compare_text_10.

Outputs (4)

NameTypeDescription
matched_value*
matched_indexINT
matchedBOOLEAN
statusSTRING