ComfyUI Node

filter select

Split a list into kept and dropped — both branches, no polarity traps

By StableLlama·Created about a year ago·Updated about 16 hours ago· 48
filter select
  • value
  • true
  • false
select

The pack's filter node keeps the False-masked items, which trips everyone up once. filter select is the version that sidesteps the problem entirely: it splits your value list into two output lists - the items where the mask was True, and the items where it was False. Both branches, in one node, no polarity to memorize.

It's part of Basic data handling, StableLlama's zero-dependency utility pack, and it's the two-output sibling of filter.

How it works

Feed it a value list and a select list of booleans. The node zips them together - element 0 of value pairs with element 0 of select, and so on - then distributes each value into one of two buckets:

  • true - the values whose corresponding select boolean was True.
  • false - the values whose corresponding select boolean was False.

Because both outputs are exposed, you never have to remember which polarity means "keep." If you only want the kept set, read the true output and ignore the other.

The inputs that matter

  • value (*) - the data list you're partitioning.
  • select (BOOLEAN) - the mask; a data list of booleans, one per value.

A realistic use

Quality-gating is the textbook case. Per-item checks (face found, sharpness OK, whatever your stack emits) produce one boolean per image; collect them and feed both the image list and the boolean list here. The true output feeds your "approved" path - upscale, save, export - while the false output routes to a repair or discard branch. Keeping both lets you do that in a single pass instead of re-running filters.

Installing it

ComfyUI Manager → search "Basic data handling", or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart. No dependencies, no models.

Common issues

  • "The two lists don't add back up to my input." If value and select differ in length, the shipped code zips them and truncates to the shorter list - the docs claim the shorter list repeats its last element to match, but the code doesn't do that. Keep the mask the same length as the values.
  • "I only needed one side." Fine - leave the other output unwired. It still computes both, but unused wires are harmless.
  • "Both outputs look empty." Check that your mask is actually a list of booleans and that every value has a matching select entry.
CategoryBasic/Data List

Inputs (2)

NameTypeDefaultDescription
value*
selectBOOLEAN

Outputs (2)

NameTypeDescription
true*
false*