Nodes/ComfyUI DataBeast/DB Convert to Float
ComfyUI Node

DB Convert to Float

Turn a data-file value into a number you can wire into a widget

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

Everything a DBGet* node hands you comes back as a string, and strings don't drive CFG sliders, denoise values, or strength widgets. DBConvertToFloat is the node that takes a DBItem and produces an actual FLOAT you can wire into anything that expects a number.

The conversion rules

The node unwraps the DBItem and casts based on the underlying type:

  • a boolean becomes 1.0 or 0.0
  • a float or int becomes its float form
  • a string is passed to Python's float(), so "3.5" works - and so does "2", giving you 2.0
  • anything it can't parse defaults to 0.0

One input (input - a DB_ITEM from any DBGet* node), one output (output - FLOAT). That's the whole node, and that simplicity is the point: in a batch workflow, DBGetBatchListDBGetItemDBConvertToFloat is how a cfg column in your data file becomes the actual CFG value each of your 50 runs uses.

Where it bites

The silent-failure pattern applies here as hard as anywhere in this pack. A string like "3.5kg" or "3,5" (Europe, I see you) raises inside float(), the exception gets swallowed, and you get 0.0 - your workflow runs with CFG 0.0 and produces garbage, with no error in sight. Keep your numeric strings clean (3.5, not cfg=3.5), and if you're pulling values out of a template system, make sure $vars{...} expansions produce plain numbers. The author's own trick for this is a db_exec: to_float block in the data file itself, which casts values to float before they ever reach the graph - worth using if you're doing the fancier procedural setup.

Installing

It's part of 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, and it's under the DataBeast category. Dependencies are only pyyaml and RestrictedPython - no model downloads, nothing heavy. After updating past the V0.1 alpha, remember DBConvert* now expect a DBItem from a DBGet* node, so re-check any graphs you saved earlier.

CategoryDataBeast

Inputs (1)

NameTypeDefaultDescription
inputDB_ITEMInput from a DBGet* node.

Outputs (1)

NameTypeDescription
outputFLOAT