Skip to content

Computed Values

Computed values let you name an arithmetic expression once and reuse it later in the same policy.

They are useful when:

  • the same calculation appears in multiple conditions
  • you want a long expression to have a readable name
  • you want to break a policy into smaller numeric steps

Define a computed value with :=:

total_requested := **requestedUnits** plus **reservedUnits**.

Reference it later with @name:

A **request** is allowed
if @total_requested is less than **monthlyAllowance**.

:= defines a named calculation in the policy. It is not a mutable variable.

Interactive Example

Policy Rule
Test Data (JSON)

Computed values can reference earlier computed values:

squared_score := **score** power of 2.
rounded_score := round @squared_score to 2 places.

A **Applicant** is approved
if @rounded_score is greater than 49.

Computed values work with aggregate expressions too:

order_total := sum of __prices__ of **Order**.
average_price := average of __prices__ of **Order**.

A **Order** qualifies for review
if @order_total is greater than 100
and @average_price is greater than 20.

Computed values can read from:

  • selector properties like **score**
  • property paths like __prices__ of **Order**
  • other computed values like @order_total
  • inline arithmetic and math functions

Computed values support the same arithmetic forms as rule conditions:

rounded := round **score** to 2 places.
total := sum of __scores__ of **Report**.
bounded := clamp(@total, 0, 100).

If your input data contains numeric strings, arithmetic still works:

incremented := **score** plus 1.
rounded := round **score** to 1 place.

with input like:

{
"score": "12.5"
}

This also applies to array aggregates such as sum of and average of.

Computed values defined with := are separate from boolean rule labels like §ageCheck.

  • use := when you want a reusable numeric calculation
  • use §label when you want one rule to depend on another rule’s pass/fail result
  • use @label from the Labels page when reading a value exposed by @@(...)

Interactive Example

Policy Rule
Test Data (JSON)