Skip to content

Calculated values

Two Logic properties produce values instead of true/false.

Expression

Expression continuously calculates the element's value. Whenever a referenced field changes, the result is recomputed and written into the field.

text
toNumber({price}) * toNumber({quantity})        line total
{firstName} + " " + {lastName}                  full name
{isCompany} ? {companyCode} : {personalCode}    pick one of two codes
sumInArray({orderLines}, "total")               sum over table rows

Rules of thumb:

  • A field with an Expression is effectively computed — combine with Read only so users don't fight the recalculation.
  • Never reference the field itself; self-referencing expressions are skipped with a console warning.
  • On Number elements the result respects the element's formatting settings (fraction digits, locale).
  • If the expression errors or returns nothing, the value is cleared.

Default value

Default value sets the initial value once, on load. The user can overwrite it.

Three forms:

FormExampleResult
Static textDraftliteral "Draft"
Token{__variables.route.id}resolved at load
Expression (prefix =)=today()evaluated at load

Common defaults:

text
=today()                        today's date
{__external.userName}           current user from the host app
{__variables.route.clientId}    id from the URL
"LT"                            fixed country pre-selection

Expression vs. Default value

ExpressionDefault value
When it runscontinuouslyonce at load
User can overrideno (recalculated)yes
Use fortotals, derived fieldssensible starting values

Worked example — invoice line

ElementTypeSetup
quantityNumberDefault value 1
unitPriceNumberfilled from a product data source
discountNumberDefault value 0
lineTotalNumber, read-onlyExpression: toNumber({quantity}) * toNumber({unitPrice}) * (1 - toNumber({discount}) / 100)