Skip to content

Filter if Parameter Exists

Some rules only apply to elements where a specific shared parameter is present. If the parameter was never bound to a family, the element is outside scope — it is not an error.

This filter restricts scope to elements where the parameter key exists in values.


The pattern

(
  $paramKey := "p_8fe8f5ce-4979-4679-b5e0-ccfb362b9059";

  $[
    type = "FamilySymbol"
    and $exists($lookup(values, $paramKey))
  ].{
    "id": id,
    "type": type,
    "name": name,
    "fireRating": $lookup(values, $paramKey).value
  }
)

What $exists() checks

$exists(expression) returns true if the expression resolves to a defined value — including null. It returns false only if the key is completely absent.

Situation $exists() result
Key present, value filled true
Key present, value null true
Key missing entirely false

This is why $exists() is the right tool here: it distinguishes between a parameter that was never bound and one that simply has no value yet.


$exists vs hasValue

For shared parameters, DAQS also exposes a hasValue field:

"p_8fe8f5ce-...": {
  "value": null,
  "hasValue": false
}
Check What it answers
$exists($lookup(values, $paramKey)) Is the parameter bound to this object at all?
$lookup(values, $paramKey).hasValue = true Is a value actually assigned?

Use $exists to scope the rule. Use hasValue inside the validator to distinguish "bound but empty" from "has a value".


Why not filter on the value directly

/* Wrong */
$[type = "FamilySymbol" and $lookup(values, $paramKey).value != null]

This silently excludes elements where the parameter exists but has no value — the exact case the rule should be reporting. Filtering on the value hides the problem instead of catching it.


Where to find the parameter key

The key format is p_ followed by the parameter GUID. To find the GUID for a parameter by name:

$[type = "Parameter" and values.name = "NLRS_C_brandwerendheid"].values.guid

Use the GUID, not the name. See Identity vs Value.