Formula Properties

Define parsed, type-checked formulas that recompute exact row-local values whenever source properties change.

Overview

Description

Formula Properties calculate row-local values from other properties through a purpose-built parser, checker, evaluator, and write-time refresh behavior.

A formula definition is parsed into a constrained expression tree, checked against live property references and result expectations, and rejected when invalid or cyclic. When source values change, computed refresh evaluates affected formulas and materializes their results through ordinary typed updates. This keeps calculation deterministic and available to queries without permitting general JavaScript execution.

Selling Points

  • Produces deterministic values without an LLM.
  • Rejects invalid or cyclic definitions before schema writes.
  • Refreshes affected values during ordinary row mutations.
  • Makes business calculations reusable across every row in a Dotabase.
  • Keeps formulas inside the typed schema and property validation model.

User Story

As an operator, I define a margin or completion formula once and trust every row to stay current. I reference supported properties in a schema-level expression and save it only after validation succeeds. Each relevant row mutation triggers refresh, so views and filters read the materialized result without repeating client logic. I walk away with one governed calculation rather than several inconsistent spreadsheet formulas.

Extension Surface

Configurable: users author supported expressions and references; the formula language and function catalog are platform-controlled.

packages/dotabases/src/properties/formula/parser.ts proves the bounded extension surface: users supply expressions in the shipped grammar. They cannot call arbitrary runtime functions or access data outside the current row through a formula.

Capabilities & Limits

  • Capability: Executes the scoped workflow described above through the cited live implementation paths.
  • Capability: Preserves typed validation and applicable tenant, schema, lifecycle, or service boundaries.
  • Limit: Formulas are synchronous and row-local. Cross-row aggregation belongs to Rollup Properties. The feature supports deterministic parsing, type-aware reference validation, cycle rejection, evaluation, and refresh after source changes. It cannot perform network calls, arbitrary code execution, or cross-row lookup. Unsupported functions and incompatible result types fail validation rather than being interpreted loosely.

Implementation Map

  • packages/dotabases/src/properties/formula/parser.ts
  • packages/dotabases/src/properties/formula/evaluator.ts
  • packages/dotabases/src/behaviors/computed-refresh/index.ts

Properties

Property
Value
product
dots-platform
extensibility
configurable
module
Dotabases
packages
dotabases
status
shipped
surface
cross-cutting
summary
Define parsed, type-checked formulas that recompute exact row-local values whenever source properties change.

Connections

Formula Properties · Explore connections

  • complementstoRollup Properties
  • requirestoTyped Property System
  • implemented bytopackages/dotabases/src/internal/properties/formula/parser.ts
  • implemented bytopackages/dotabases/src/internal/properties/formula/evaluator.ts
  • implementstoDS_Dotabases — Comprehensive Module Spec
  • implementstoDS_Dotabase-Dashboards — Dashboard View, Aggregation Engine & Computed Properties
  • implemented bytoparseFormula
  • implemented bytoevaluateFormula
  • complementsfromRollup Properties

Connected Records9

Complements
Implemented by
evaluateFormula
packages/dotabases/src/internal/properties/formula/evaluator.ts
packages/dotabases/src/internal/properties/formula/parser.ts
parseFormula
Implements
DS_Dotabase-Dashboards — Dashboard View, Aggregation Engine & Computed Properties
DS_Dotabases — Comprehensive Module Spec
Requires
9 connections.