Skip to content

Schema Reference ​

An Axiomers app is defined by a schema: a JSON array of collections. Everything you build in the visual editor (fields, views, actions, formulas) is stored as this JSON, and the same JSON can be read, written, or generated directly. This page is the exhaustive reference for that format. For a walkthrough of the visual editor, start with Collections & Fields, Views, Actions & Workflows, and Expressions.

This page is written to be precise enough for an AI assistant to draft a valid schema from a plain description of an app.

The whole app in one file ​

The collections are the core, but an app also has roles and a home screen header. All three travel together in one document, the app definition. This is what Download axiomers-app.json writes, what Import reads, and what the AI generator produces.

json
{
  "format": "axiomers-app",
  "version": 1,
  "collections": [ { "name": "customers", "...": "..." } ],
  "roles": {
    "roles": [
      { "name": "technician", "startCollection": "jobs",
        "permissions": { "jobs": { "full": false, "view": true, "create": false, "update": true, "delete": false } } }
    ],
    "defaultRole": "technician"
  },
  "home": {
    "panels": [
      { "type": "text", "title": "CONCATENATE(\"Welcome back, \", USERPROFILE(\"name\"))" },
      { "type": "stat", "collection": "jobs", "aggregate": "count", "filter": "EQUAL({status}, \"open\")" }
    ]
  }
}
  • A bare array still works. A file that is only the collections array (an older axiomers-schema.json) imports as { "collections": [...] }.
  • A missing key means "leave it as it is". A file with only home changes only the home header. To clear a part, send an explicit empty value: "roles": { "roles": [], "defaultRole": null } or "home": { "panels": [] }.
  • Roles and the header stay unsaved until you Save. On import they are staged, so you can review them on the Roles and Navigation pages first. They are applied after the schema, because role permissions refer to collections.
  • Over the API, GET /provision/apps/{appId}/bundle returns the saved app in this shape, and POST /provision/apps/{appId}/bundle applies one in a single call (schema, then roles, then home, each reported separately). Add ?cleanup=true to also remove collections that are no longer listed.
  • Header panel types. text (a greeting: title, subtitle), stat (collection, aggregate of count, sum, avg, min or max, field, filter, label, and optionally view, the list view of that collection that tapping the card opens), view (collection, view, limit, label, filter) and value, a card that shows what a formula returns: value (the formula), label (the caption), format (text as it comes, number with thousands separators, or money) and currency (a code such as NGN, for money). Every panel also takes col (3, 4, 6 or 12) and showIf.
  • Header formulas have no record. In home, a bare {field} reads nothing. Use USERPROFILE("name") or {_THISUser.name}, and put {field} only inside a query such as FILTER or SELECT.

The sections below describe the collections part in detail. Roles are covered in Roles & Permissions and the header in Navigation.

Collection ​

A collection is one kind of record (customers, orders, visits…).

json
{
  "name": "customers",
  "label": "Customers",
  "icon": "people",
  "order": 1,
  "schema": [],
  "actions": [],
  "views": [],
  "defaultView": "table"
}
PropertyRequiredMeaning
nameyesUnique machine key, snake_case. Used in formulas and as the table name.
labelyesHuman-readable name.
iconnoA Material icon name.
orderyesSort order in the sidebar. Also the sync order: a collection that others reference should have a lower order than the collections that reference it.
schemayesThe fields: an array of field definitions.
actionsyesButtons: an array of action definitions.
viewsyesWays to look at the records: an array of view definitions.
defaultViewyesThe name of the view that opens first. Must match one of views[].name.
isUserProfilenotrue on the single collection that holds one record per signed-in user.
navnoNavigation options. Where the collection appears: sidebar (laptop menu, default true), menu (phone hamburger menu, default follows sidebar), bottom (phone bottom bar, default false), home (a tile on the home screen, default false; its width is homeCol: 3, 4, 6 default, or 12 out of 12; homeStyle is row default or stacked, one look for the whole grid, written on every tile). Order in each: order (sidebar), menuOrder, bottomOrder and homeOrder (each defaults to order). The home screen opens first when an app's defaultCollection, or a role's startCollection, is set to "home-screen". Also onlyIf (a formula; the item is hidden when it is false), label and icon. The bottom bar has no item limit and scrolls sideways when the tabs don't fit. The Navigation designer writes these keys.
isSettingsnotrue on the one collection that holds the app's shared settings: a single record of values such as a commission rate, read in formulas with SETTINGS("field"). At most one per app, and not the profile collection. The server creates its record (from the fields' initial values) and no one can add another or delete it; the app opens it as a form, not a list. Every signed-in person can read it; who can change it is the role's Update ("Can edit" on the permissions page).
serverManagednoSet by the platform on system collections such as payments (see Payments). People can read these records but only the server can write them. Don't set it yourself, and don't name your own collection payments.

Fields ​

Each entry in a collection's schema array is a field definition:

json
{
  "key": "status",
  "label": "Status",
  "type": "enum",
  "description": "Where the order is in its life cycle",
  "required": true,
  "typeOptions": {
    "values": [
      { "value": "draft", "label": "Draft", "color": "grey" },
      { "value": "confirmed", "label": "Confirmed", "color": "green" }
    ]
  },
  "initialValue": "\"draft\""
}
PropertyMeaning
keyThe field's internal name. Unique within the collection; can't be changed later.
labelWhat people see as the field's name.
typeOne of the field types below.
descriptionHelp text. In a questionnaire it becomes the question text.
requiredCan't be left blank.
readOnlyShown, but not editable on forms.
isLabelMarks the record's short recognizable name (one per collection), shown in reference pickers.
labelExpressionA formula that overrides label with a computed value.
typeOptionsOptions that depend on type, see below.
computed{ "enabled": true, "expression": "…" }: the value is calculated from a formula instead of typed in.
initialValueA formula evaluated once when the create form opens, to pre-fill the field.
showIfA formula; the field is hidden (and its value cleared) when it is false.
validIfA formula; the field is invalid on submit when it is false.
validMessageThe error shown when validIf fails.

Every record also has built-in fields you can reference in formulas: id, ownerId, updatedAt, isDeleted.

Field types ​

TypeStorestypeOptions
textA stringminLength, maxLength, placeholder, mask, enableScanner (adds a QR/barcode scan button), format: "email" (the value must look like an email address; see below)
longtextA multi-line stringsame as text
richtextSanitized HTML from a formatting editornone
numberA numbermin, max, step, prefix, suffix, decimals
priceA number shown as currencydefaultCurrency, allowedCurrencies, decimals
percentageA number from 0 to 100, where 72 means 72%. Entered in a box with a % sign, and drawn on views as a bar or a ring.displayAs ("linear" bar, the default, or "circular" ring with the figure in the middle), decimals (0 to 2, default 0). The form refuses values outside 0 to 100, and the database field holds the same limits. Build one with PERCENT(part, whole).
booleantrue / falsedisplayAs ("toggle" default, "tabs" for a two-way segmented control, or "select" for a dropdown), trueLabel, falseLabel (the wording for each answer, shown in the control and wherever the value appears; blank means Yes / No)
date / datetime / timeA date, a date and time, or a time of daynone
enumOne of a fixed set of values (a string)values
multienumSeveral of a fixed set of values (an array of strings)values
refA link to one record in another collection (its id)collection, displayField, …
multirefLinks to several records in another collection (an array of ids)collection, displayField, …
image / fileAn uploaded fileaccept, maxSizeMb, multiple
drawingA signature or sketch, stored as an imagestrokeColor, strokeWidth, background, maxSizeMb
geolocation{ "lat": number, "lng": number } captured from the device or picked on a map (with place search)accuracy (low/medium/high), timeout
address{ "country", "state", "city" }defaultCountry (e.g. "Nigeria") and defaultState (e.g. "Rivers"): the address a new record starts with, as the country and state names the form's pickers list. A state only counts together with its country. People can change it, a saved record keeps its own address, and an initialValue on the same field wins.
phoneOne string, dial code plus number, e.g. "+2349071805738"defaultDialCode (e.g. "+234"): the country code an empty field starts on. A number already saved keeps its own code, and a code the user picked earlier on their device takes priority.
barcodeA string, rendered as a barcode or QR codeformat (qrcode, code128, ean13, upc), showValueLabel, width, height
tableAn array of row objects you type incolumns: [{ "key", "label" }]
listVirtual, always computed: a list of values from related recordsdisplayField, collection, sort
completelistVirtual, always computed: an embedded table of related recordscollection, columns, sort

values for enum and multienum is an array of { "value", "label", "color"?, "icon"? }.

"format": "email" on a text field means the value must look like an email address (ISEMAIL's check). It is enforced in the app's forms, in public forms (the page checks before sending and the server checks again), in webhooks and in CSV or JSON imports, where a typo like ada@gmail is refused with a message naming the field. The box also opens the phone's email keyboard. It checks the shape only: it can't tell whether the mailbox exists. A blank value is fine unless the field is required.

One choice or several? ​

There is no "allow multiple" flag on enum or ref for new fields: multiple selections are their own types:

  • One choice from a fixed set → enum. Several ("tick all that apply") → multienum.
  • One related record → ref. Several related records → multiref.

multienum takes the same typeOptions as enum, and multiref the same as ref, just without multiple.

ref and multiref options ​

json
{
  "key": "customer",
  "label": "Customer",
  "type": "ref",
  "typeOptions": {
    "collection": "customers",
    "displayField": "full_name",
    "searchField": "phone",
    "barcodeSearch": false,
    "isDistinct": false,
    "suggestedValues": "EQUAL({status},\"active\")",
    "defaultValue": "{_THISUser.id}"
  }
}
OptionMeaning
collectionThe collection to link to. It must exist in the schema.
displayFieldThe field shown as each option's label.
searchFieldThe field matched when the user types in the picker (defaults to displayField).
barcodeSearchAdds a scan button that searches searchField.
suggestedValuesA formula evaluated per candidate record to filter the picker's options.
defaultValueA formula that pre-selects a value when the form opens.
isDistinctHides any option that another record in this collection already uses through this field (for multiref, any item in another record's list), and rejects it on save. The record being edited keeps its own value. It's a check against the records on the device, so two people offline can still pick the same item before they sync.

multiref has a few limits compared with ref:

  • Dot-traversal ({field.prop}) only works through a plain ref, not a multiref. A bare {multirefField} still works and gives the array of ids.
  • The navigate_ref action follows a plain ref only.
  • A multiref can't be the foreignKey in REF_ROWS(...).
  • A ref or multiref can be set by CSV/JSON import and by an inbound webhook: the sender gives the id of the record (or a list of ids for a multiref), and the row or webhook is refused with a message if any id doesn't exist.
  • A multienum can be set by CSV/JSON import and by an inbound webhook with a list of its option values. A calculated field can't be mapped in a webhook: its value is worked out from other fields, so anything sent into it would be ignored.
  • A webhook can send fields back. A saved request answers 201 with {"ok": true, "id": "<new record id>", "fields": {...}}, where fields holds the values you ticked under Return these fields in the webhook's settings. A calculated field can be returned, so a formula is how you hand back a custom value such as a booking reference. Only this record's own values come back (a reference as the other record's id), files and lists can't be returned, and the values are read just after saving: if that takes more than about 3 seconds the answer is still 201 with ok and id but no fields. The settings warn when a chosen field holds contact details such as a phone number or address, since the answer goes to whoever sent the request.
  • multiref and multienum are left out of the "colour by" / "status badge" pickers on calendar and card views (those need exactly one value).

When you need any of these, use ref.

Virtual fields ​

list and completelist hold no data of their own. A completelist must have computed: { "enabled": true, "expression": "…" }: almost always REF_ROWS("otherCollection", "foreignKeyOnThatCollection"), otherwise it renders nothing.

Views ​

A view is one way of looking at a collection's records.

json
{
  "name": "table",
  "type": "table",
  "sections": [
    { "order": 1, "items": [
      { "order": 1, "type": "field", "key": "full_name" },
      { "order": 2, "type": "action", "key": "edit" }
    ] }
  ],
  "sort": { "field": "full_name", "dir": "asc" },
  "pagination": { "enabled": true, "limit": 25 }
}
PropertyMeaning
nameIdentifier. Unique within the collection.
typedetail, card, image-card, table, calendar, chart, dashboard, questionnaire, feed, board, or carousel. There is no list type, use table for any tabular listing.
sectionsOrdered groups of items. An item is { "order", "type": "field" | "action", "key" }; the key must exist in the collection's fields or actions. A section can also have a label, an onlyIf formula, and (detail views only) col: 3|4|6|12 out of 12 (quarter/third/half/full, default 6). Sections wrap onto new rows, so several narrow ones can sit side by side; ignored outside a detail view.
filterFieldsField keys to expose as filter controls above the view (not for detail).
showIfA formula; the whole view tab is hidden when it is false.
filterExprA formula evaluated per record; records where it is false are hidden.
pagination{ "enabled": boolean, "limit": number }.
sort{ "field": string, "dir": "asc" | "desc" }.
groupByA field key. Lists the records under one heading per value, with a count. Only for table, card, image-card, feed and board views, and the field must be an enum, boolean or ref (not multienum or multiref). Display only: records keep the view's sort inside each group. For a board it is required, must be an enum or boolean, and is the field the columns come from.

Every collection needs a detail view (conventionally named detail): it's the only way to open a single record. Avoid making it the defaultView: it can't list records, so people would see nothing on open. Use table, card, calendar, chart, dashboard, or questionnaire.

Layouts ​

View typeExtra propertyShape
card, image-cardcardLayout{ "title": key, "subtitle"?: key, "description"?: key, "status"?: key, "image"?: key }: status must be an enum, image an image field
boardcardLayout + groupByThe cards use cardLayout exactly as a card view does (title is required). groupBy (an enum or boolean field, editable by the people who use the board) makes the columns, one per value, and moving a card writes that field. A read-only field makes a board that refuses every move. sections is an empty array, and a board has no pagination.
carouselnoneShows the collection's detail view one record at a time, with previous and next buttons. It has no layout of its own: sections is an empty array, and it has no pagination or groupBy. sort, filterFields, filterExpr and showIf work as in other list views.
feedfeedLayout{ "caption": key, "title"?: key, "subtitle"?: key, "image"?: key, "status"?: key }: caption is required and a text field, image must be an image field, status an enum
calendarcalendarLayout{ "startDate": key, "title": key, "startTime"?: key, "endDate"?: key, "endTime"?: key, "color"?: key or color name, "defaultMode"?: "month" | "week" | "day" }
chartchartLayoutsAn array of { "type": "bar" | "line" | "pie" | "doughnut", "labelField": key, "valueField"?: key, "color"?: string, "showLegend"?: boolean }. Omit valueField to count records per label.
dashboarddashboardPanelsAn array of panels, below

Card and image-card views are laid out by cardLayout alone. Their sections aren't used, so leave it as an empty array.

A feed's buttons are not part of feedLayout: list them as "type": "action" items in sections[0], in the order they should show. They must be record-scoped actions of the same collection. A feed with no buttons has "sections": []. See examples/community-feed.axiomers-app.json.

color on a chart applies to line charts only; bar, pie and doughnut charts colour each label automatically. To colour by status, set color on the enum field's own values instead.

Dashboard panels: each has a type (view or stat) and optionally col (the width out of 12: 3, 4, 6 or 12), title, showIf, filter (a formula), sort and actions (keys of collection-scoped actions). A view panel also takes viewName and limit; a stat panel takes field and aggregate (count, sum, avg, min, max).

Questionnaire views ​

A questionnaire view is a multi-step, one-question-at-a-time data-entry wizard, like a survey or intake form. Use it for interviews, assessments, checklists, inspections, or any long form that is easier to fill in step by step.

json
{
  "name": "intake",
  "type": "questionnaire",
  "sections": [
    { "order": 1, "label": "About the patient", "items": [
      { "order": 1, "type": "field", "key": "full_name" },
      { "order": 2, "type": "field", "key": "date_of_birth" }
    ] },
    { "order": 2, "label": "Symptoms", "items": [
      { "order": 1, "type": "field", "key": "symptoms" }
    ] }
  ],
  "listFields": [
    { "order": 1, "type": "field", "key": "full_name" }
  ]
}
  • Each section is one step. The section's label is the step title and its items are the questions asked on that step.
  • The question text is the field's description, falling back to its label when there is no description. Keep label short (it's still used in tables and filters) and put the full question in description, e.g. label Cause of death, description What was the main cause of death?.
  • Validation runs per step (required, validIf) before the user can continue, and again on submit.
  • listFields are the columns shown in the list of already-submitted records that the view opens on. It is separate from sections. If omitted, the first step's fields are used.
  • Every field type works inside a questionnaire, including multienum and multiref.
  • Answers are saved exactly like a normal create/edit form, so a questionnaire can sit alongside table or card views of the same collection.

Actions ​

An action is a button. Each collection should include the three system actions: delete (data/delete), edit (app/navigate_edit) and create (app/navigate_create), all with "isSystem": true, unless the collection is deliberately read-only.

json
{
  "key": "mark_paid",
  "label": "Mark paid",
  "icon": "paid",
  "type": "data",
  "onlyIf": "EQUAL({status},\"confirmed\")",
  "needsConfirmation": true,
  "confirmMessage": "Mark this order as paid?",
  "actionConfig": {
    "type": "set_field",
    "updates": [ { "field": "status", "value": "\"paid\"" } ]
  }
}
PropertyMeaning
key, label, icon, colorIdentity and appearance.
typedata, external, or app.
onlyIfA formula; the button is hidden when it is false.
needsConfirmation, confirmMessageAsk before running.
afterWhere to go once the action has run successfully: { "type": "back" | "list" | "detail" | "create", "collection"?: name, "view"?: name }. collection applies to list and create (default: this collection); view applies to list only and names a list view of that collection to open it on (never the detail view); detail is the record the action ran on. Omit it to stay put (a delete still goes back by default). Ignored for the navigate_*, open_create and payment actions, for automatic (trigger other than manual) actions, and for steps inside a run_actions sequence (the sequence's own after applies once, at the end). detail isn't allowed for delete, bulk_delete or collection-level actions.
scoperecord (default, a button per record) or collection (shown at the bottom of dashboard panels).
triggermanual (default, a button click), or afterCreate / afterUpdate / afterDelete to run automatically after that event, with no button.
actionConfigDepends on type, see below.

Data actions ​

actionConfig.typeOptions
set_field, bulk_set_fieldsupdates: [{ "field", "value": formula }]. set_field changes the current record only. Bulk also takes expression (a COLLECTIONSELECT that selects the rows) and collection (the collection those rows belong to, which can be another one); its updates are evaluated against each matched row.
delete, bulk_deleteBulk takes expression.
create_record, bulk_create_recordcollection and mappings: [{ "targetField", "sourceExpression": formula }]. Bulk also takes expression.
form_actionformTitle, formFields (full field definitions, referenced as {_FORM.key}), and updates.

External actions ​

actionConfig.typeOptions
phone, email, urltarget: a formula resolving to the number, address, or URL.
http_requesttarget (a fixed URL string, never a formula), method (GET, POST, PUT, PATCH, DELETE), headers and queryParams ([{ "key", "value", "secret" }]), body ([{ "field", "value" }]), responseMapping ([{ "field", "path" }], where path is a dot-path into the { ok, status, body } response), and optionally responseCollection to create a new record instead of updating the current one.
paymentamountField (the key of a stored number or price field on this collection, in naira; a computed field can't be used), optional description, and target set to "". The amount is read from the saved record on the server. See Payments & Earnings.

For a secret header or query parameter (an API key, a token), set "secret": true and leave value as "". The real value is entered later in the admin secrets screen and never appears in the schema.

App actions ​

actionConfig.typeOptions
navigate_detail, navigate_edit, navigate_create, navigate_listOptional collection. navigate_create also takes optional questionnaireView: the name of a questionnaire view on the target collection to open as a wizard instead of the plain form. navigate_create and navigate_edit also take optional openAs: "dialog" opens the form in a dialog over the current page (closing when saved) instead of its own page; omit it, or use "page", for the page. A dialog is always the plain form, so it wins over questionnaireView. navigate_list also takes optional view: the name of a list view of the target collection to open the list on, for that visit only (the address carries it as ?view=name); a view that doesn't exist, is the detail view, or is hidden from the person is ignored and the list opens as usual.
navigate_refrefField: follows a plain ref field on this collection to its target record.
navigate_by_idcollection and targetIdExpression: a formula resolving to the target record's id. Use for reverse relations navigate_ref can't reach, e.g. FIRST(SELECT("stock_items","id",EQUAL({product.id},{_THISRECORD.id}))).
run_actionsactions: an array of action keys, run in sequence.
export_pdftemplate (HTML with <<{[field]}>> tokens) and filename (a formula). A price field is written as money in its own currency and decimals (₦18,300.00), in a loop's rows and for computed prices too; other types are written as stored.
export_csvOptional columns: an array of field keys for the file, in order ("id" is the record id). Left out, the columns of the list view the button is on are used, or every field. Optional filename (a formula; .csv is added). Always "scope": "collection": the button sits on the collection's list and exports the records shown there.
open_createcollection, prefill: [{ "key", "expression" }], and optionally afterSubmitNavigate (back, list, detail) with afterSubmitCollection (and afterSubmitView, a list view name, when it is list), and questionnaireView (a questionnaire view on the target collection: opens its wizard, with the prefill applied and locked, instead of the plain form). A name that doesn't match a questionnaire view falls back to the plain form. openAs: "dialog" opens the create form in a dialog over the current page instead (prefill applied and locked, afterSubmitNavigate still applies, back and none just close it); it wins over questionnaireView.

Expressions ​

Formulas appear in computed.expression, initialValue, showIf, validIf, onlyIf, filterExpr, action values, and suggestedValues / defaultValue. They are spreadsheet-style function calls with {field} references.

There are no infix operators. +, -, *, /, >=, <=, ==, &&, || all fail to parse: everything is a function: ADD(a,b), SUBTRACT(a,b), MULTIPLY(a,b), DIVIDE(a,b), GTE(a,b), LTE(a,b), EQUAL(a,b), AND(a,b), OR(a,b). A minus sign is only ever a negative number.

References ​

ReferenceMeaning
{field}A field on the current record.
{ref.prop}A field on the record a ref points at. Chains work: {shift.location.name}.
{_THISRECORD.field}Inside a query condition: the outer record, rather than the row being tested.
{_THISUser.field}The signed-in user.
{_FORM.field}A value entered in a form_action dialog.
{_PREVROW.field}, {_NEXTROW.field}, {_INDEX}, {_TOTAL}Position within a list pass.

Quoting ​

Inside a formula string, write string literals with ordinary double quotes; in JSON that is one level of escaping: "expression": "DATEDIFF({end},{start},\"days\")". Don't escape twice: the formula language has no escape syntax of its own.

The condition argument of FILTER, COLLECTIONSELECT, EXISTS, SELECT and ORDERBY (and the extraCondition of REF_ROWS) is best written as a plain inline expression: EXISTS("cartitem", EQUAL({product},{_THISRECORD.product})). The older form, where the condition is passed as a quoted string, still works but can't contain its own string literals. Collection names, returnColumn, lookupColumn, sortField and foreignKey are always string literals, never field references. The one exception is the first argument of FILTER, COLLECTIONSELECT, EXISTS, SELECT, ORDERBY and ORDERBYDESCENDING: written as a braced {list field} (a completelist) instead of a collection name, it filters that list of records directly, with no collection read, e.g. COUNT(FILTER({tasks}, EQUAL({status},"open"))). Leave the condition out entirely when there isn't one.

Function library ​

Where a parameter lists fixed values (like unit), they're literals: "day" instead of "days" silently does nothing.

Collections ​

FunctionDescription
EXISTS(collection | {list}, condition?)True if any record matches.
FILTER(collection | {list}, condition)Matching records.
COLLECTIONSELECT(collection | {list}, condition)Matching records, including their computed fields.
REF_ROWS(collection, foreignKey, extraCondition?)Every record in collection whose foreignKey ref points back at this record. Shorthand for COLLECTIONSELECT(collection, EQUAL({foreignKey},{_THISRECORD.id})).
SELECT(collection | {list}, returnColumn, condition?)An array of one column's values.
ORDERBY(collection | {list}, returnColumn, condition?, sortField?)Like SELECT, sorted ascending.
ORDERBYDESCENDING(collection | {list}, returnColumn, condition?, sortField?)Like SELECT, sorted descending.
LOOKUP(value, collection, lookupColumn, returnColumn)A single value looked up across a collection.
IN(value, list)True if the value is in the array.
COUNT(array)Number of items.
FIRST(array), LAST(array)First or last element.
SUMARRAY(array)Sum of the numbers in an array.
HERE()The device's current location (client-side only, use in initialValue).
USERPROFILE(field)A field from the signed-in user's profile record.
SETTINGS(field)A field from the app's settings record (the collection with isSettings), such as SETTINGS("vendor_percentage"). Blank when the app has no settings collection, or when the field is hidden from the person's role.

Logic ​

FunctionDescription
IF(condition, then, else)Conditional.
IFS(cond1, val1, cond2, val2, …, default)The first true condition's value wins; a trailing unpaired argument is the default.
SWITCH(value, match1, result1, match2, result2, …, default)The result of the first match equal to the value (compared like EQUAL); a trailing unpaired argument is the default, and with none the result is blank. Shorter than IFS when one value is compared with several options.
AND(…), OR(…), NOT(a)Boolean logic.
EQUAL(a, b)Equality.
GT(a, b), LT(a, b), GTE(a, b), LTE(a, b)Number comparison. Not for dates, use ISBEFORE / ISAFTER / ISBETWEEN.
ISBLANK(value)True for null, undefined, or an empty string.
ISEMAIL(text)True when the text looks like an email address (name@example.com). A blank value is not one, so an optional field uses OR(ISBLANK({email}), ISEMAIL({email})).
ROLE(name)Validates a role name against the app's configured roles, returning it if valid and null if not, which catches typos. Compare with it: EQUAL(USERPROFILE("role"), ROLE("admin")).
ENUM(collection, field, option)Validates an option of an enum field, returning it if it is one of the field's values and null if not (a typo, or an option renamed since). Use it where a formula compares to an enum value: EQUAL({status}, ENUM("orders", "status", "packed")).

Text ​

FunctionDescription
CONCATENATE(…)Joins values (or a single array) into one string.
JOIN(separator, …)Joins values (or a single array) with a separator.
UPPER(v), LOWER(v), TRIM(v)Case and whitespace.
LEN(v)Length of a string or array.
LEFT(v, n), RIGHT(v, n)First or last N characters.
CONTAINS(v, search)True if the string contains the substring.
REPLACE(v, search, replacement)Replaces every occurrence.
NUMBERFORMAT(value, decimals?)A number as text with thousands separators: NUMBERFORMAT(124000) is 124,000. With no decimals it keeps up to two and drops trailing zeros; with one it shows exactly that many (0 to 20): NUMBERFORMAT(1234.5, 2) is 1,234.50. Rounds halves away from zero. Blank for a non-number. Returns text, so format last.
MONEYFORMAT(value, currency?, decimals?)An amount as text with the currency sign: MONEYFORMAT(124000) is ₦124,000.00, MONEYFORMAT(1500, "USD") is $1,500.00, MONEYFORMAT(1500, "KES", 0) is KSh 1,500, a loss is -₦3,000.00. currency is a code (default NGN); decimals defaults to 2. A code with no sign of its own is shown as typed. Blank for a non-number. Returns text, so format last.

Math ​

FunctionDescription
ADD(a, b, …), SUBTRACT(a, b), MULTIPLY(a, b, …), DIVIDE(a, b)Arithmetic. DIVIDE returns null on division by zero.
MOD(n, divisor), POWER(base, exp), SQRT(v), ABS(v)Remainder, power, square root, absolute value.
ROUND(v, decimals?)Rounds to N decimal places (none given: a whole number); halves round away from zero. A negative N rounds to tens, hundreds: ROUND(1234, -2) is 1200.
MROUND(v, multiple)Rounds to the nearest multiple: MROUND(1234, 10) is 1230, MROUND(1234, 50) is 1250. A multiple of 0 gives 0.
CEILING(v, multiple?), FLOOR(v, multiple?)Round up to the next multiple, or down to the previous one (toward larger or smaller numbers, for negatives too). The multiple is 1 when left out: CEILING(1201, 100) is 1300, FLOOR(2.9) is 2.
PERCENT(part, whole, decimals?)What part of the whole is done, from 0 to 100, rounded to 2 decimals unless you say otherwise: PERCENT({done}, {total}) gives 37.5. Blank when the whole is 0 or blank. Made for a percentage field. It doesn't clamp, so PERCENT(15, 10) is 150.
MIN(…), MAX(…), AVERAGE(…)Pass an array (from SELECT, say) or separate values.
DISTANCEBETWEEN(a, b, unit?)Great-circle distance between two geolocation values. unit: meters (default) or km.
LATITUDE(geolocation)The latitude of a geolocation field as a number, blank if the field is empty. Handy for an HTTP request's query parameters: LATITUDE({location}).
LONGITUDE(geolocation)The longitude of a geolocation field as a number, blank if the field is empty.
ADDRESS(address, part?)Text from an address field. part: "city", "state", "country", or "full" (the default), which is all three as the views show them, such as Port Harcourt, Rivers, Nigeria, with blank parts left out. Blank if the field is empty or the part is. Handy for filtering or grouping by state: ADDRESS({address}, "state").

Dates and times ​

For date and datetime comparisons always use ISBEFORE, ISAFTER and ISBETWEEN.

FunctionDescription
NOW(), TODAY(), YESTERDAY(), TOMORROW(), TIMENOW()The current moment (with the time, so it changes every second), or today/yesterday/tomorrow at midnight (the same all day), or the current time. Use TODAY() for anything measured in days.
DATE(year, month, day, time?)Builds a date. month is 1-based; time is "HH:mm" or "HH:mm:ss".
TIME(value, date?)Resolves an HH:mm(:ss) string against today or a given date.
DATEADD(date, n, unit)Adds a duration. unit: seconds, minutes, hours, days, weeks, months, years.
DATEDIFF(a, b, unit)a minus b, as a whole number of units (same units as DATEADD; the fraction is cut off). Put the later date first, or the result is negative.
DATEFORMAT(date, format)format: long, short, month, iso.
TIMEFORMAT(date, format?)The time of day of a date as text. format: 24h (default, 14:30) or 12h (2:30 PM). Also takes a plain time such as a time field holds.
DAYOFWEEK(day)The date of a weekday this week (sunday … saturday, lowercase).
YEAR(d), MONTH(d), DAY(d), HOUR(d), MINUTE(d), WEEKDAY(d)Date parts. WEEKDAY is 0 (Sunday) to 6.
STARTOFDAY(d?), ENDOFDAY(d?), STARTOFYEAR(d?), ENDOFYEAR(d?), STARTOFMONTH(), ENDOFMONTH()Period boundaries (default: now).
ISBEFORE(a, b), ISAFTER(a, b), ISBETWEEN(d, start, end)Date comparisons (ISBETWEEN is inclusive).

Generating values ​

These re-roll every time they are evaluated, so use them in initialValue (evaluated once when the create form opens), never in a computed expression, where the value would keep changing.

FunctionDescription
RAND(min?, max?)A random number from 0 up to (not including) 1, or, with both arguments, a random whole number between them, inclusive. RAND(1000, 9999) is a random 4-digit number.
UNIQUEID()A fresh globally unique id (UUID v4).
UNIQUECHAR(type, length)A random string. type: letters, numeric, alphanumeric, special, or all (letters, numbers and special characters together). length: a whole number from 1 to 64. Returns blank for an unknown type or bad length. Random, not guaranteed unique: 4 alphanumeric characters give about 1.7 million combinations, so collisions become likely after a few thousand records. Use UNIQUEID() when a value must never repeat.
json
{ "key": "booking_code", "label": "Booking code", "type": "text",
  "readOnly": true, "initialValue": "UNIQUECHAR(\"alphanumeric\", 6)" }

Rules of thumb ​

  • Every ref / multiref typeOptions.collection must name a collection that exists.
  • Every field item in a view must exist in the collection's schema, and every action item in its actions.
  • defaultView must match a view name, and should almost never be a detail view.
  • Reverse relationships come in pairs: a completelist on one collection (with a REF_ROWS formula) and a ref on the other: add both halves together.
  • Keep formulas to the functions listed above; don't invent new ones.
  • Prefer a simple schema that works over an exhaustive one.

A complete example ​

A small visits log: a patients collection, and a visits collection with a reference, a multi-select, and a questionnaire view.

json
[
  {
    "name": "patients",
    "label": "Patients",
    "icon": "person",
    "order": 1,
    "schema": [
      { "key": "full_name", "label": "Full name", "type": "text", "required": true, "isLabel": true },
      { "key": "phone", "label": "Phone", "type": "phone" },
      { "key": "visits", "label": "Visits", "type": "completelist",
        "typeOptions": { "collection": "visits", "columns": ["visit_date", "conditions"] },
        "computed": { "enabled": true, "expression": "REF_ROWS(\"visits\", \"patient\")" } }
    ],
    "actions": [
      { "key": "delete", "label": "Delete", "icon": "delete", "type": "data", "isSystem": true,
        "needsConfirmation": true, "actionConfig": { "type": "delete" } },
      { "key": "edit", "label": "Edit", "icon": "edit", "type": "app", "isSystem": true,
        "actionConfig": { "type": "navigate_edit" } },
      { "key": "create", "label": "New", "icon": "add", "type": "app", "isSystem": true,
        "actionConfig": { "type": "navigate_create" } }
    ],
    "views": [
      { "name": "table", "type": "table",
        "sections": [ { "order": 1, "items": [
          { "order": 1, "type": "field", "key": "full_name" },
          { "order": 2, "type": "field", "key": "phone" }
        ] } ] },
      { "name": "detail", "type": "detail",
        "sections": [ { "order": 1, "label": "Patient", "items": [
          { "order": 1, "type": "field", "key": "full_name" },
          { "order": 2, "type": "field", "key": "phone" },
          { "order": 3, "type": "field", "key": "visits" },
          { "order": 4, "type": "action", "key": "edit" },
          { "order": 5, "type": "action", "key": "delete" }
        ] } ] }
    ],
    "defaultView": "table"
  },
  {
    "name": "visits",
    "label": "Visits",
    "icon": "medical_services",
    "order": 2,
    "schema": [
      { "key": "patient", "label": "Patient", "type": "ref", "required": true,
        "description": "Which patient was seen?",
        "typeOptions": { "collection": "patients", "displayField": "full_name" } },
      { "key": "visit_date", "label": "Visit date", "type": "date", "required": true,
        "description": "When did the visit take place?", "initialValue": "TODAY()" },
      { "key": "conditions", "label": "Conditions", "type": "multienum",
        "description": "Tick every condition that applies",
        "typeOptions": { "values": [
          { "value": "fever", "label": "Fever" },
          { "value": "cough", "label": "Cough" },
          { "value": "headache", "label": "Headache" }
        ] } },
      { "key": "reference", "label": "Reference", "type": "text", "readOnly": true,
        "initialValue": "UNIQUECHAR(\"alphanumeric\", 6)" }
    ],
    "actions": [
      { "key": "delete", "label": "Delete", "icon": "delete", "type": "data", "isSystem": true,
        "needsConfirmation": true, "actionConfig": { "type": "delete" } },
      { "key": "edit", "label": "Edit", "icon": "edit", "type": "app", "isSystem": true,
        "actionConfig": { "type": "navigate_edit" } },
      { "key": "create", "label": "New", "icon": "add", "type": "app", "isSystem": true,
        "actionConfig": { "type": "navigate_create" } }
    ],
    "views": [
      { "name": "intake", "type": "questionnaire",
        "sections": [
          { "order": 1, "label": "Who and when", "items": [
            { "order": 1, "type": "field", "key": "patient" },
            { "order": 2, "type": "field", "key": "visit_date" }
          ] },
          { "order": 2, "label": "Symptoms", "items": [
            { "order": 1, "type": "field", "key": "conditions" }
          ] }
        ],
        "listFields": [
          { "order": 1, "type": "field", "key": "patient" },
          { "order": 2, "type": "field", "key": "visit_date" }
        ] },
      { "name": "detail", "type": "detail",
        "sections": [ { "order": 1, "label": "Visit", "items": [
          { "order": 1, "type": "field", "key": "patient" },
          { "order": 2, "type": "field", "key": "visit_date" },
          { "order": 3, "type": "field", "key": "conditions" },
          { "order": 4, "type": "field", "key": "reference" },
          { "order": 5, "type": "action", "key": "edit" },
          { "order": 6, "type": "action", "key": "delete" }
        ] } ] }
    ],
    "defaultView": "intake"
  }
]

Released under no license yet — internal product, pre-launch.