Skip to content

$compareFireRating

Compares two fields that should contain the same fire rating value — the built-in Revit Fire Rating type parameter and the shared parameter NLRS_C_brandwerendheid. Returns a consistency object for use with the applicability gate pattern.


Definition

$compareFireRating := function($fireRating, $nlrs){
  (
    $fireExists := $exists($fireRating) and $fireRating != null;
    $nlrsExists := $nlrs.paramExist and $nlrs.value != "Parameter niet aanwezig";

    $fireVal := $fireExists ? $string($fireRating) : "";
    $nlrsVal := $nlrsExists ? $string($nlrs.value) : "";

    {
      "checkApplicable": $fireExists and $nlrsExists,
      "fireRatingValue": $fireVal,
      "nlrsValue":       $nlrsVal,
      "isEqual":         ($fireExists and $nlrsExists)
                           ? ($fireVal = $nlrsVal)
                           : true
    }
  )
};

Parameters

Parameter Type Description
$fireRating any The value of values.fireRating from the current element
$nlrs object The result of $getSharedParam($, "NLRS_C_brandwerendheid")

Return value

{
  "checkApplicable": true,
  "fireRatingValue": "60",
  "nlrsValue": "30",
  "isEqual": false
}

When one of the two values is absent, checkApplicable is false and isEqual defaults to true — the rule does not fire for elements where the comparison cannot be made.


Usage

$[type = "FamilySymbol" and values.category.type = "Model"].{
  "id": id,
  "name": name,
  "fireRating": values.fireRating,
  "NLRS_C_brandwerendheid": $getSharedParam($, "NLRS_C_brandwerendheid"),
  "fireRatingConsistency": $compareFireRating(
    values.fireRating,
    $getSharedParam($, "NLRS_C_brandwerendheid")
  )
}
[fireRatingConsistency.checkApplicable]

The [fireRatingConsistency.checkApplicable] at the end is the applicability gate — elements where neither field is filled are excluded from the result.

Validators access:

  • fireRatingConsistency.isEqualbool:Is true
  • fireRatingConsistency.fireRatingValuelist:IsIn [0, 30, 60, 90, 120]
  • fireRatingConsistency.nlrsValuelist:IsIn [0, 30, 60, 90, 120]

Used in rules

  • rule-01536396 — NLRS_C_brandwerendheid = Fire Rating