Skip to content

Computed fields

Computed fields are attributes whose value is not entered manually, but derived automatically from other fields of the same record. The calculation runs on the server when a record is saved – the result is consistent, traceable, and independent of where the record was created (form, process, import).

Derived values such as gross amounts, full names, or due dates therefore stay always in sync with the source data – without modeling a separate service task.


When does a computed field make sense?

A computed field is the right choice when a value can be uniquely derived from other fields of the same record and should always be up to date.

Typical examples:

  • Gross price from net price and VAT rate.
  • Full name from first name and last name.
  • Due date from invoice date plus payment terms.
  • Status flag from multiple conditions (e.g., "overdue" if due date passed and status is not "paid").
  • Total quantity from line items.

Add a computed field

  1. Open a data structure in the Data Designer and click "+ Add attribute".
  2. Choose name, type, and properties as for a regular attribute.
  3. Open the "Calculation" section and enable it.
  4. Pick a language (JSONata or JavaScript) and enter the expression.
  5. Save.

Computed fields are automatically read-only in the form and are visually highlighted (subtle gradient background, dashed border, hint "Calculated automatically").

Supported types

Computed fields are available for text, number, integer, boolean, date, and timestamp. List (array) fields are not currently supported as computed.


Languages for the expression

JSONata

JSONata is a compact query language for JSON structures. It is well suited for simple lookups, formatting, and aggregations.

$.net * (1 + $.vatRate / 100)
$.firstName & " " & $.lastName

JavaScript

For more complex logic, JavaScript can be used. The expression receives the current record as the variable obj.

obj.net * (1 + obj.vatRate / 100)
obj.status === 'open' && new Date(obj.dueDate) < new Date() ? 'overdue' : obj.status

Which language to pick?

JSONata is more concise and typically the better choice for plain data transformations. JavaScript is recommended for conditions, date arithmetic, or multi-step logic.


Order of multiple computed fields

When several computed fields exist, they are evaluated in attribute order. A later computed field can reference the result of an earlier one.

Example: An invoice contains three computed fields:

  1. netTotal – sum of all line items.
  2. vatAmountnetTotal times the VAT rate.
  3. grossTotalnetTotal plus vatAmount.

Because fields are evaluated sequentially, grossTotal can directly access netTotal and vatAmount.

The order can be adjusted in the Data Designer via drag and drop.


Example: Gross price from net + VAT

Attribute Type Calculation
net Number
vatRate Number
gross Number $.net * (1 + $.vatRate / 100) (JSONata)

When saving a record with net = 100 and vatRate = 19, gross is automatically set to 119 – including records that originate from a process or an import.


Example: Due date from invoice date

new Date(new Date(obj.invoiceDate).getTime() + obj.paymentTerms * 86400000).toISOString().slice(0, 10)

Sets the due date to the invoice date plus the number of days defined in paymentTerms.


Notes

  • Computed fields are recalculated on every save. Subsequent corrections to source fields are picked up automatically.
  • Results are persisted in the record and become available to dashboards, reports, tables, and exports – like any other attribute.
  • If a computed field references another computed field, the referenced field must appear earlier in the attribute list.
  • Faulty expressions (e.g., invalid syntax) are logged – the field remains empty in that case.
  • An existing value can be turned back into a regular input field at any time by disabling the calculation.

Difference from form expressions

Expressions in the Data Designer control the behavior of a field in the form (visible, disabled, required). Computed fields, in contrast, produce a persistent value inside the record itself.

Aspect Expressions Computed fields
When applied When the form is rendered When the record is saved
Where applied Form (UI) Record (stored value)
Result Visibility, required state, etc. Concrete field value
Persisted? No Yes