Boolean validators
Boolean parameters in Revit are tri-state: Yes, No, and Unset.
That matters. A lot.
Boolean — Is
Used for
A Boolean validator checks only for:
true or false
Nothing else.
How it works
- Reads the boolean value from the filter output
- Compares it to the expected boolean state
What this means in practice
When you use a Boolean validator, you are asserting:
- The parameter exists
- The parameter is of boolean type
- The value resolves to true or false
That’s it.
What a Boolean validator does not interpret
A Boolean validator does not understand:
"Yes"/"No"as text1/0as numbers- Empty values
- Missing parameters
Those are separate decisions and must be handled explicitly with:
- Property validators (exist / not exist)
- Null validators (should be null / not null)
Important Revit-specific reality (state this clearly)
In Revit, a Boolean parameter can be:
- True
- False
- Unset
But for the Boolean validator:
- Only true and false are valid inputs
- Unset is not true and not false → it must be handled before or around the Boolean check
This ties directly back to your checklist:
- Does the parameter exist?
- Is it set?
- Only then: is it true or false?
Boolean — Is not
Is not Used for
Ensuring a boolean parameter is not set to a specific value.
Is not How it works
- Reads the boolean value
- Fails if it equals the forbidden value
What it will find
- The opposite boolean value
- Unset values (depending on context)
What it will not find
- Missing parameters
- Implicit false assumptions
⚠️ Revit Boolean pitfall — Unset is not False
In Revit, a Boolean parameter added ad Project Parameter has three possible states:
- True
- False
- Unset
This is not theoretical — it happens in real models.
Why this matters for validation
A Boolean validator only evaluates:
truefalse
If a Boolean parameter is Unset:
- It is not true
- It is not false
- It does not automatically fail
- It does not automatically pass
From the validator’s perspective, the value is simply not usable.
In Revit, for a Yes/No parameter:
- Checked →
True - Unchecked →
False - Greyed out → Unset (no value assigned)
Two elements can both appear “not checked” in a report, while their data meaning differs:
False→ explicitly uncheckedUnset→ never set,hasValue = false
If a parameter is required, a greyed-out (Unset) value must fail — even though it is not true.
Correct validation pattern for mandatory boolean parameters
- Check that the parameter exists (property validator or
$exists) - Check that
hasValue = true - Then validate the boolean value as required
✅ Decide explicitly what Unset means for this rule. ❌ Never treat Unset as False.