create SET from BOOLEANs
Collect a pile of booleans into a SET — then ask it questions
- SET
When a workflow has several independent checks - image loaded, mask exists, prompt non-empty, seed valid - you end up with a scattered pile of booleans. This node gathers them: give it a set of BOOLEAN inputs (dynamically extensible, like all this pack's create nodes) and it returns a SET of them. And here's the quiet genius of it: because sets dedup, True and False can each appear at most once. So a whole batch of checks collapses into a tiny two-value set you can interrogate.
Then the pack's SET logic takes over. all on that set answers "did every check pass?" any answers "did at least one?" contains - or its all/any siblings - tell you whether a False snuck in. It's a clean way to build an "all conditions met" gate without wiring a dozen boolean nodes into one comparison, and it's why this pack's SET family is more than a gimmick: it's a genuinely ergonomic way to aggregate results.
How it works
set(bool(value) for value in items) - the items are cast to real booleans on the way in, so even a string "False" from another node becomes the boolean False (the string itself is truthy, which is exactly the trap this casting prevents). The dedup is what makes the aggregation work: {True, False} is the maximum this SET can hold, and every question you'd want to ask - all passed, any passed, contains a failure - becomes a one-node lookup. Since the inputs are typed BOOLEAN, mixed-type weirdness (1 vs True) can't happen.
Inputs and output
Dynamic item_0, item_1, ... - all BOOLEAN, all optional. One output, the SET. Wire it to SetAll / SetAny / SetContains for the actual decisions.
Installing it
Part of Basic data handling by StableLlama:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart, or install via ComfyUI Manager (search "Basic data handling"). Zero dependencies, no model downloads - the pack is stdlib-only and install-safe.
Gotchas
- An all-optional-input node with nothing connected returns an empty set - and remember,
allon an empty set isTruewhileanyisFalse. If you build this node but forget to wire a check, you'll get "everything passed" out ofall. That's the silent failure to watch for. - The cast-to-boolean means truthiness rules apply on input: only actual
True/Falsevalues behave as labeled, and anything else arriving is coerced, not compared. Feed it real booleans. - You can't tell which check failed from the set alone - just that a
Falseexists. Keep the sources mapped elsewhere if you need to branch per-check.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| item_0opt | BOOLEAN | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SET | SET | — |