Nodes/ComfyUI DataBeast/DB Convert to Boolean
ComfyUI Node

DB Convert to Boolean

Get a real true/false out of a data-file value

By hanoixan·Created 2 years ago·Updated 2 years ago· 2
DB Convert to Boolean
  • input
  • output

The DataBeast DBGet* nodes always hand you back strings wearing a DB_ITEM costume. That's fine for prompts, useless for toggles. DBConvertToBoolean is the node that turns a data value into a real ComfyUI boolean - the thing you feed into if-style routing, node bypasses, or boolean widgets that expect actual true/false, not the text "true".

How it decides

The node unwraps the DBItem and applies a straightforward truthiness rule to whatever type it finds:

  • an actual boolean passes through unchanged
  • a float or int is true if it's not zero
  • a string is true only if it lowercases to exactly "true" - so "TRUE", "True", and "true" all count, and anything else (including "1" or "yes") is false
  • anything unrecognized defaults to false

There's exactly one input - input (DB_ITEM from any DBGet* node) - and one output, output (BOOLEAN).

Where it bites

The string rule is the trap. If your data file says enabled: 1 or enabled: yes, this node reads it as false. Realistically that's fine because the typical flow is DBGetItem → this node, and DBGetItem stringifies everything - so a YAML enabled: true becomes the string "true" on the way out, and this node recovers it. But if your source data stores booleans as 1/0 or yes/no, convert them to true/false in the file (or run it through DBConvertToInt first) or you'll be scratching your head at toggles that never flip. And like the rest of this pack, failures are silent: anything it can't classify quietly returns false.

Installing

It ships with ComfyUI DataBeast, which is not in ComfyUI Manager yet:

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

Restart ComfyUI and look under the DataBeast category. Just pyyaml and RestrictedPython for dependencies - no models. Given the V0.2 API rework (DBConvert* now expect a DBItem from DBGet*), give older graphs a check after updating.

CategoryDataBeast

Inputs (1)

NameTypeDefaultDescription
inputDB_ITEMInput from a DBGet* node.

Outputs (1)

NameTypeDescription
outputBOOLEAN