Nodes/WAS Node Suite v3/Boolean Reduce
ComfyUI Node Runs on cloud

Boolean Reduce

All, any, none, exactly one, or majority

By WASasquatch·Created 3 years ago·Updated 4 days ago· 1,844
Boolean Reduce
    • boolean
    • true_count
    • count
    reductionall
    condition_afalse
    condition_bfalse
    condition_cfalse
    condition_dfalse
    condition_efalse
    condition_ffalse
    condition_gfalse
    condition_hfalse
    condition_ifalse
    condition_jfalse
    condition_kfalse
    condition_lfalse
    condition_mfalse
    condition_nfalse
    condition_ofalse
    condition_pfalse
    condition_qfalse
    condition_rfalse
    condition_sfalse
    condition_tfalse
    condition_ufalse
    condition_vfalse
    condition_wfalse
    condition_xfalse
    condition_yfalse
    condition_zfalse

    Here's a sentence nobody wants to build by hand: four conditions all have to be true before the save fires. With the basic two-input AND node that means three ANDs daisy-chained, and every one of them is another node to read and another place to miswire. Boolean Reduce is the "fold all my conditions into one answer" node, and it handles up to 26 of them in a single box.

    Under WAS Suite/Logic/Boolean, you pick a reduction from a dropdown and wire in any number of condition_a through condition_z sockets. The modes are the standard boolean folding operations plus the two nobody else bothers to ship:

    • all - every connected condition must be true. The multi-input AND.
    • any - at least one true. The multi-input OR.
    • none - every connected condition false.
    • exactly one - precisely one true and the rest false. Great for "these options are mutually exclusive and I need to confirm it."
    • majority - more than half true. The quality-gate workhorse: "if most of my checks pass, ship it."

    Unconnected slots simply aren't counted, so the reduction always runs over what's actually wired - you can have a 26-condition node with three wires in it and it behaves as a 3-input node. With three wired and two of them true: all = false, any = true, none = false, exactly one = false, majority = true. The tooltip's own example, and worth internalising before you wire it backwards.

    The outputs that make it diagnosable

    Past the combined boolean, the node reports two numbers: true_count (how many connected conditions are actually true) and count (how many are connected). These are the difference between a magic black box and something you can debug. When a majority gate mysteriously refuses to fire, true_count tells you instantly that it's 2 of 5 instead of 3 of 5 - no guessing which condition flipped. Wire true_count into a Compare and you can even build thresholds that the dropdown doesn't offer, like "at least four of these six must pass."

    The shape of real use

    This is the natural companion to the suite's other boolean logic. You can chain it with itself - one Reduce collecting individual comparisons, its output feeding another Reduce that folds whole groups - though the design intent is to keep that from being necessary. Where people reach for it most: quality gating before a save (image dimensions sane AND seed not blacklisted AND detector found a face), multi-stage validation before a video encode, and the "should we even attempt this branch" checks that would otherwise be a wall of AND nodes.

    The honest limit: every input is a plain boolean. If your inputs are values that need testing first - "is this width over 512", "does this text contain a keyword" - those tests are WAS Compare Any's job, and Compare Any feeds Boolean Reduce perfectly. Test first, reduce second, gate third.

    Installing

    Part of WAS Node Suite v3 (WASasquatch/was-node-suite-comfyui), WASasquatch's MIT suite, going since 2023 and one of the packs that's been in the essentials conversation from the start. Logic nodes like this one are pure plumbing: no packages to pip-install, no model weights, no config. It needs ComfyUI 0.14.0+ because v3 targets ComfyUI's newer node backend.

    Via ComfyUI Manager, search WAS Node Suite v3, or clone:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/was-node-suite-comfyui
    

    Restart, and it's under WAS Suite/Logic/Boolean. Node missing after install? Update ComfyUI - on anything older than 0.14.0 the pack won't register.

    CategoryWAS Suite/Logic/Boolean

    Inputs (27)

    NameTypeDefaultDescription
    reductionCOMBOallHow the conditions combine. With 3 wired and 2 true: `all` = false, `any` = true, `none` = false, `exactly one` = false, `majority` = true.
    condition_aoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_boptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_coptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_doptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_eoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_foptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_goptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_hoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_ioptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_joptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_koptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_loptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_moptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_noptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_ooptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_poptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_qoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_roptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_soptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_toptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_uoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_voptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_woptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_xoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_yoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.
    condition_zoptBOOLEANfalseOne condition, `true` or `false`. An unconnected slot is not counted, so the reduction runs over what is actually wired.

    Outputs (3)

    NameTypeDescription
    booleanBOOLEANThe combined answer. Wire it to any switch's boolean.
    true_countINTHow many connected conditions are true.
    countINTConnected conditions.