Skip to main content

Computed Fields

Computed fields automatically calculate their values from other fields using formulas. Use them for scoring, totals, and derived values without manual data entry.

What are Computed Fields?​

A computed field is a special field type that:

  • Calculates automatically - Values are computed when the record is saved
  • Updates on change - Recalculates whenever dependent fields change
  • Cannot be edited directly - Users can't override the formula result
  • Uses CEL expressions - Write formulas using Common Expression Language (CEL)

Common Use Cases​

Use CaseExample Formula
Scoringrecord.data.q1 + record.data.q2 + record.data.q3
Totalsrecord.data.subtotal * 1.1 (add 10% tax)
Categorizationrecord.data.score >= 10 ? "High" : "Low"
Age calculationnow.year - record.data.birth_year

Creating a Computed Field​

  1. Go to Data in your workspace
  2. Select a Data Type or create a new one
  3. Click Add Field
  4. Choose Function as the field type
  5. Open the field's settings (select its row) and enter your formula in the CEL Expression box
  6. Save the Data Type

Writing Formulas​

Basic Syntax​

Reference other fields using record.data.<field_slug>:

# Add three fields together
record.data.question_1 + record.data.question_2 + record.data.question_3

# Multiply two fields
record.data.quantity * record.data.price

# Conditional logic
record.data.age >= 18 ? "Adult" : "Minor"

Computed formulas run with the current record, its Member, and the now date parts. Available variables and functions vary by CEL context; see the Developer CEL reference for the full list.

Examples​

GAD-7 Anxiety Scoring​

The GAD-7 is a 7-question anxiety screening with scores 0-3 per question:

record.data.q1 + record.data.q2 + record.data.q3 + record.data.q4 + record.data.q5 + record.data.q6 + record.data.q7

Score Interpretation​

Add another computed field to interpret the score:

record.data.total_score >= 15 ? "Severe" :
record.data.total_score >= 10 ? "Moderate" :
record.data.total_score >= 5 ? "Mild" : "Minimal"

BMI Calculator​

Calculate BMI from height (inches) and weight (pounds):

(record.data.weight / (record.data.height * record.data.height)) * 703

Days Until Birthday​

Calculate days remaining (simplified - uses year only):

record.data.birth_month > now.month ? record.data.birth_month - now.month : 12 - now.month + record.data.birth_month

Limitations​

  1. No circular references - A computed field cannot reference another computed field
  2. No external data - Formulas can only use fields from the same Data Type
  3. Missing values default to 0 - If a referenced field is empty, it's treated as 0
  4. No string operations - Limited to basic CEL string functions

Troubleshooting​

"References unknown field"​

The field slug in your formula doesn't exist. Check:

  • The field slug is spelled correctly (case-sensitive)
  • The field exists in this Data Type (not a different Data Type)
  • You're using record.data. prefix

"Cannot reference another function field"​

You tried to reference one computed field from another. Computed fields can only reference regular (non-computed) fields.

Formula returns wrong value​

  • Check field types - Ensure numeric fields are defined as Number or Whole number, not Text
  • Check for nulls - Empty fields become 0, which may affect calculations
  • Test with simple values - Try hardcoding numbers to isolate the issue

Field Validation​

Beyond computed fields, CEL can also validate user input. Fields support a validateCel property that checks values before data is saved. For field setup, see Data Types; for syntax and context-specific variables, see the Developer CEL reference.

  • Knowledge - Creating and managing Data Types
  • Actions - Configure event-triggered actions