Dynamic Values & Calculations

Dynamic Values & Calculations

Often, you may need to display some text or dynamically calculate a value.

For example, you may want to show different text in a field based on what the user has previously answered, or maybe you have a product order Form that should calculate the total amount to pay.

This is where the Dynamic Value property found on most form fields comes in handy.

Dynamic Value allows you to create a formula that generates or calculates a result that is assigned as the given field’s answer.


Handling calculations

For example, imagine you have the following Form fields:

  • “Enter Product Name” – a Text field with Dataname of productName
  • “Enter Product Cost” – a Number field with Dataname of productCost
  • “Enter Number of Items” – a Number field with Dataname of numberItems
  1. Add a new Hidden field to your Form, and set the Dataname to be totalIncludingTax
  2. On this new field, find the Dynamic Value property.
    Its found under the Validation & Behavior property section of a field.
  3. Enter the following formula into the Dynamic Value:
    {{productCost}} * {{numberItems}} * 1.10

What we’ve done so far is add a hidden field (a field the app user will never see) which will store the result of the formula calculation. The formula is applying a 10% tax rate to the product cost amount. This field’s value can now be used in other fields in the form and output.

This is the first example of how you can use the Dynamic Value property to calculate results.


Joining static and dynamic text

Now we’re going to use Dynamic Value again to display a message to the app user. We want to summarise their order details using a read-only Text field.

  1. Add a new Text field to your Form, set the Data Name to be “orderSummary”.
  2. Find the Read Only property and tick the box.
    This will make the field read-only, so the user cannot change the displayed answer text.
  3. Find the Dynamic Value property and enter the following formula:
    CONCAT('You ordered ', {{numberItems}}, ' of ', {{productName}}, '. Total (including tax) is: ', {{totalIncludingTax}})

What we’re doing with the above formula is building up dynamic text, by concatenating together pieces of text.

The CONCAT() function is used to build up the final text, and we are using the values from the various fields (the {{dataName}} bits).


Supporting articles

Formula Cheat Sheet

Creating a Formula

Formula Quick Question/Answer Reference

    • Related Articles

    • Dynamic Answers & Calculations (Dynamic Values)

      Often you may need to display some text or calculate a value in a dynamic fashion. For example, you may want to show different text in a field based on what the user has previously answered. Or maybe you have a product order Form that should ...
    • Dynamic Form Data Sources

      When designing forms and you need to display a list of options in-app, a Choices field is the tool to use. Where you can add a static list of options (Display/Answer values) or link a data source to drive the field’s options. However, this requires ...
    • Dynamic Form Properties

      The Form Designer provides dynamic functionality that you’ll find in the properties area when clicking on a Form field. Typically, you’ll be able to configure Basic Properties Title Text The title text is shown to the user. Dynamic Filtering of ...
    • Dynamic Images in Forms

      The “Dynamic Image” property allows you to load images dynamically into Media, Sketch, and Section fields, usually through a data source column or a formula result. The dynamic image property allows you to, with the use of formulas, dynamically ...
    • Global Values – Saving entry values for reuse

      Sometimes you may want to store values on the device to reuse on the same Screen or in multiple Screens. For example, say you have a common field in several Form Screens that the user has to select every time – e.g. a project, client or job number. ...