Nodes/ComfyUI-YogurtNodes/DictContainsValue (Yogurt Nodes)
ComfyUI Node

DictContainsValue (Yogurt Nodes)

Check for a value in any dict — handy when you care about contents, not names

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
DictContainsValue (Yogurt Nodes)
  • dict_data
  • value
  • contains

Where DictContainsKey checks whether a dictionary has a field, DictContainsValue asks whether any field equals a value. You feed it a dict and a value, and it returns true if that value appears anywhere in the dict's values. It's the "does my config contain the thing I care about" check, and it's genuinely useful when you're working with data where the keys vary but the values are the meaningful signal.

Think of the scenarios: you parsed a list of model settings and want to know if "upscaled" shows up anywhere as a status value; you're checking whether a response dict contains an error string regardless of which field it landed in; you want to branch on "does this batch metadata mention 'failed'." Because it scans all values, it's the forgiving version of key-checking - you don't need to know the schema, just the content you're hunting for.

How it works

Under the hood it's value in dict_data.values(), a plain Python membership test across all values. Two things to know: matching is exact (no substring, no case-folding - "failed" and "Failed" are different), and the value input is *-typed, so you can search for numbers, strings, or other objects, not just text. If you need fuzzy matching, combine it with DictFilter and a regex instead.

Inputs & output

  • dict_data - any dict-like object.
  • value - the thing to search for, any type.
  • contains - BOOLEAN: true if the value appears in the dict's values.

Install

Ships in ComfyUI-YogurtNodes:

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

Or via ComfyUI Manager (search "YogurtNodes") and restart. Under "Yogurt Nodes" → Logic.

Common issues

  • "It should match but doesn't" - exact match only. Check for trailing whitespace, case, and type (string "1" vs. integer 1 are different values).
  • "I want a fuzzy match" - use DictFilter with a regex pattern instead; this node is exact.
  • "I'm getting true unexpectedly" - if a value appears in any entry, it returns true. That's the point, but it means one stray match lights the whole thing up. If you need to know which key matched, filter first and inspect.

It's the mirror image of DictContainsKey, and the two together cover "check the schema" and "check the data." For value-driven branching, this is the one you'll reach for.

CategoryYogurtNodes/Logic

Inputs (2)

NameTypeDefaultDescription
dict_data*Any dict-like object
value*Value to search for

Outputs (1)

NameTypeDescription
containsBOOLEAN