$getSharedParamBool
Reads a boolean shared parameter from an object. Returns true, false, or null — never the raw numeric value (0/1) that Revit stores internally.
Definition
$getSharedParamBool := function($object, $logicalName){
(
$guid := $lookup($paramGuids, $logicalName);
$sp := $guid and $exists($object.values)
? $lookup($object.values, "p_" & $guid)
: undefined;
$exists($sp)
? (
$exists($sp.value)
? $boolean($sp.value)
: null
)
: null
)
};
Dependencies
Requires $paramGuids in the outer scope:
$paramGuids := {
"IsExternal": "576da907-5f75-40ce-a0c1-572ca690fc1b",
"IsExternal2": "28fecb30-be2a-40c6-9fb0-703be83c5e9f"
};
Parameters
| Parameter | Type | Description |
|---|---|---|
$object |
object | The element to read from (pass $ for current element) |
$logicalName |
string | The key in $paramGuids |
Return value
| Situation | Returns |
|---|---|
Parameter exists, value = 1 |
true |
Parameter exists, value = 0 |
false |
| Parameter exists, no value | null |
| Parameter absent | null |
Why $boolean() is needed
Revit stores boolean parameter values as numbers: 1 for true, 0 for false. Without $boolean(), the value 0 is truthy in some JSONata comparisons. Converting explicitly makes the intent clear and the behaviour reliable.
Usage
$[type = "FamilyInstance" and $exists(parent)].{
"id": id,
"name": name,
"IsExternal": $getSharedParamBool($, "IsExternal")
}
Validator: IsExternal → bool:Is true
Used in rules
rule-eb5d3f9a— Function is null → IsExternal → true