Mobile Form Expression Evaluation and Updates

For most properties, an expression:

  1. Runs when the form opens.

  2. Records the element properties that it references.

  3. Runs again whenever one of those properties changes.

  4. Assigns the returned value to the configured property.

Only directly referenced element properties become dependencies. If an expression references quantity.value and price.value, changes to unrelated elements do not cause that expression to run.

For example, the following expression calculates a total:

          {
  "quantity": {
    "label": "Quantity",
    "type": "number"
  },
  "price": {
    "label": "Price",
    "type": "number"
  },
  "total": {
    "label": "Total",
    "type": "number",
    "value": "(quantity.value || 0) * (price.value || 0)"
  }
} 

        

When the form opens to create a record, the expression sets total.value to 0. If the user enters a quantity of 3 and a price of 5, the total becomes 15.

Related Topics

General Notices