Skip to main content

Compute

Compute fields calculate values dynamically based on other fields in the same record or across relationships. They're read-only and recalculate automatically when source fields change.

Go to StudioCollections → [Collection Name] → Fields tab → Add Field, then select Compute. To edit an existing field, click the edit action next to it.

View all settings
SettingDescription
Field NameText input, required. Unique identifier.
Input TypeDropdown, required. The context type (Relation, Association, Self).
RelationDropdown. The relationship to compute across (if applicable).
Function TypeDropdown, required. The operation to apply (for example, SUM, AVG).
Display LabelText input. Human-readable label shown in forms.
IconIcon picker. Visual identifier.
StatusToggle, defaults to true. Enable or disable the field.
Save to DatabaseToggle, defaults to false. Persist the computed value.
DescriptionText area. Documents the field's purpose.

Setup

To set up a Compute field:

  1. Select the Input Type to define the context (for example, Relation).
  2. Choose the specific Relation to compute across.
  3. Select the Function Type (the actual operation to perform).

Function Types

Compute offers many calculation functions depending on the context:

Math Operations

Function TypeDescriptionRequires
AdditionSum multiple fields2+ Fields, Scale
SubtractionSubtract target from sourceSource Field, Target Field, Scale
MultiplicationMultiply multiple fields2+ Fields, Scale
DivisionDivide source by targetSource Field, Target Field, Scale
ModuloRemainder of divisionSource Field, Target Field
Absolute ValueAbsolute valueSource Field, Scale
Round NumberRound to decimal placesSource Field

String Operations

Function TypeDescriptionRequires
ConcatenateCombine fields with pattern2+ Fields, Concat Pattern
UppercaseConvert to uppercaseSource Field
LowercaseConvert to lowercaseSource Field
SubstringExtract part of textSource Field, Start Index, End Index
String LengthCount charactersSource Field

Date Operations

Function TypeDescriptionRequires
Add to DateAdd interval to dateSource Field, Interval Value, Interval Unit
Subtract Interval from DateSubtract interval from dateSource Field, Interval Value, Interval Unit
Date DifferenceDifference between datesSource Field, Target Field
Current TimestampCurrent date/timeNone
Age (Years)Calculate age in yearsSource Field
Full Age (Y/M/D)Full age as years/months/daysSource Field
Extract YearsExtract years from date diffSource Field
Extract MonthsExtract months from date diffSource Field
Extract WeeksExtract weeks from date diffSource Field
Extract DaysExtract days from date diffSource Field

Conditional Settings

Based on your selected Input Type, additional fields appear:

SettingUsed ByDescription
Source FieldMost operationsPrimary field for computation
Target FieldSubtraction, Division, Modulo, Date DifferenceSecondary field
FieldsAddition, Multiplication, ConcatenateMultiple fields (minimum 2)
Concat PatternConcatenatePattern using {fieldName} placeholders
SeparatorString return typesCharacter between concatenated values
ScaleMath operationsDecimal places for result
Start IndexSubstringStarting position
End IndexSubstringEnding position (must be > Start Index)
Date Interval ValueAdd to Date, Subtract Interval from DateAmount of time
Date Interval UnitAdd to Date, Subtract Interval from DateUnit: DAY, WEEK, MONTH, YEAR

Advanced Settings

The Description text area lets you document the computation's purpose.

Turn on Save to Database if you need to sort or filter by this field — persisting the value lets the database index it.

Query Filters

The Query Filters tab lets you add filter conditions to your computation:

SettingDescription
ConjunctionFirst filter uses WHERE, subsequent filters use AND or OR.
FieldSelect a field to filter on.
OperatorComparison operator (is equal to, etc.).
ValueThe value to compare against.

Click Add Filter to add multiple conditions.

Use Cases

  • Calculate order totals — Addition of line item prices
  • Full name from parts — Concatenate {firstName} {lastName}
  • Age from birthdate — Age (Years) with date field
  • Inventory value — Multiplication of quantity × unit price
  • Days until due — Date Difference between today and due date