Skip to content

BBILS Helper Functions

This folder documents the reusable helper functions that appear in BBILS filter queries. Each function encapsulates a recurring pattern so that the main query stays readable.


Filter helpers

Function Purpose
$getSharedParam Read any shared parameter by logical name; returns full metadata object
$getParam Compact variant: returns { exists, hasValue, value, valueAsString }
$getSharedParamBool Read a boolean shared parameter; returns true, false, or null
$getSharedParamValue Read a numeric shared parameter; returns a number or null
$compareFireRating Compare two fields for consistency; returns { checkApplicable, isEqual }
$countSameRooms Count how many other Rooms share the same Room Number
$countSameSpace Count how many other Spaces share the same Space Number; also returns their names
$arrayContains Check whether a value exists in an array (including arrays of numbers)

How helpers are used

All helpers are defined inline at the top of the filter query, then called inside the projection:

(
  $paramGuids := { "MyParam": "some-guid-here" };

  $getSharedParam := function($object, $logicalName){ ... };

  $[type = "FamilySymbol"].{
    "id": id,
    "name": name,
    "myParam": $getSharedParam($, "MyParam")
  }
)

Functions are not imported from a library — they are copied into each rule that needs them.