Nodes/comfy-ovum/Add Value to List (if boolean)
ComfyUI Node

Add Value to List (if boolean)

Conditionally append one value to a list, based on a boolean

By sfinktah·Created about a year ago·Updated 10 months ago· 7
Add Value to List (if boolean)
  • py_list
  • value
  • bypass
  • no_bypass
  • py_list

This is a tiny list-building helper: feed it a list and a value, and it gives you back the list with that value appended - but only when a boolean condition says so. It's the kind of node that looks pointless until you're building a list of prompts, models, or seeds from a chain of conditional branches and you realize "append only if this flag is set" is a step you keep re-implementing.

It sits in the ovum/loop category, and it's clearly meant to be a building block for the Foreach/Map loop nodes in the same pack - think of it as a guarded append inside an iteration where some items should make it into the accumulator and others shouldn't.

The inputs

  • py_list (*) - the list to grow. If it's blank or missing, the node starts fresh with an empty list.
  • value (*) - whatever you want to append. Any type; lists and dicts included.
  • bypass (BOOLEAN) - the gate. The tooltip says "Bypass adding this value to the list."
  • no_bypass (BOOLEAN) - "Do not bypass adding this value to the list."

Output is a single py_list (*) with the (possibly) appended result.

The honest warning

The two boolean gates are the fiddly part, and the author's own code betrays the confusion: it raises an error if bypass and no_bypass are ever equal, which means they must disagree whenever both are set. The practical upshot: with both left at their defaults the value gets appended, and you drive one of the two flags to gate it. But the exact meaning of each flag is easy to get backwards, and the two names read like they should mean the same thing. Test with a two-item list and a visible value before you trust it inside a big loop. This is a "check your work" node, not a "set and forget" one.

Installing it

Part of comfy-ovum:

cd ComfyUI/custom_nodes
git clone https://github.com/sfinktah/comfy-ovum

Restart, or grab it via ComfyUI Manager under "comfy-ovum". No models, no extra dependencies.

When it earns its place

Honestly, this is a node you'll reach for inside a Map/Foreach loop when you're folding items into an accumulator conditionally - e.g. "append this prompt only if the flag is set" - or when assembling a list from several gated branches. For a single unconditional append, plain list concatenation is simpler. Its niche is the case where "whether the value joins the list" is itself a decision in the graph.

Categoryovum/loop

Inputs (4)

NameTypeDefaultDescription
py_listopt*
valueopt*
bypassoptBOOLEAN,*false
no_bypassoptBOOLEAN,*false

Outputs (1)

NameTypeDescription
py_list*