Skip to main content

The Calculation field

Automatically calculate a value from a formula and configure its result, display and export tag.

Overview of the Calculation field

The Calculation field displays a value calculated automatically from a formula, which can use the values of other fields in the form.

It lets you, among other things:

  • perform simple operations: addition, subtraction, multiplication, division;

  • calculate a total, an average, a minimum or a maximum on a table column;

  • calculate a duration between two times or two dates;

  • use mathematical functions: power, square root, logarithm, rounding
;

  • get a different result depending on one or more conditions;

  • combine text and values in a single result.

Adding the field to a form

On the form creation screen, whether the form is new or existing, the field catalog on the left groups the fields into nine categories. Only one category is open at a time: click its name to open it. The Calculation field is the only field in the Calculation category. Hovering over the field displays a short description.

There are three ways to add the field:

  • Click Calculation: the field is inserted just after the selected field. If no field is selected, it is added at the end of the form.

  • Drag and drop it from the catalog to the desired location. While you drag, the insertion areas are shown with a dotted outline.

  • The + button that appears below the hovered or selected field: it opens a menu with a search bar to insert a field at that exact spot.

As soon as the field is added, its title switches to edit mode: type its name and confirm with the Enter key. To rename it later, double-click its name. The mobile Preview updates with every change.

Accessing the field options

In the editing area, double-click the field or click the pencil icon (Edit). The options are displayed as cards.

They appear in this order: Essentials, Formula, Visibility conditions, Display & layout and Advanced, followed by the Technical identifier.

There is no confirmation button: each setting is applied immediately, and ✓ Modified is displayed after each change. To move around the options:

  • Undo (the arrow at the top) or Ctrl+Z: goes back one step.

  • ↑ and ↓ in the header: move to the previous or next field without returning to the form.

  • Back (the arrow at the top left): closes the options and returns to the form.

â„č Good to know
Only the Save button saves the form permanently. Until you save, nothing is sent to mobile devices.

While the options are open, the catalog is greyed out. Close them to add a new field.

Essentials

This card contains the basic settings of the field. As the value is calculated automatically, it does not offer a Required entry option.

  • Field title: by default, it is the name of the field type ("Calculation"), but you can change it.

  • Choose an icon (the button to the left of the title): displays an icon in front of the field title, in the mobile app as well as in Web entry. Icons are grouped by theme (Statuses & alerts, Arrows & navigation, People & gender, etc.) and a search is available. No icon removes the icon.

  • Display mode: Digit or Hour.

  • Number of decimals: number of digits displayed after the decimal point.

  • Editable result: the user can manually correct the calculated result.

  • Help text shown on mobile: enter an instruction for your users. During data entry, they can view it by tapping the question mark shown to the right of the field title.

Formula

This card contains the formula input area. You can type the formula directly, or build it using the toolbar above.

The toolbar

Button

Role

Field

Inserts the value of a form field. The field appears in the formula in square brackets, for example [Quantity].

Function

Inserts a function: sum, average, rounding, condition


+ − × Ă·

Insert an addition, a subtraction, a multiplication or a division. The + sign also lets you combine text and values.

If


Opens a wizard to build a condition.

Text

Inserts a text value, in quotation marks.

⋯

Gives access to the other operators: Modulo (remainder of division), comparisons and logical operators. A search lets you find them quickly.

Below the formula, a message shows whether it is valid and how many fields it uses, for example "Valid formula · 2 field(s) referenced". If the formula is incomplete, the message "Incomplete or invalid expression." is displayed in red.

Fields that can be used

The Field button only offers the fields that can be used in a calculation: input fields, check boxes, sliders, counters, dates and times, lists, single choices, references, barcodes, NFC tags
 The list depends on where the Calculation field is placed:

  • outside a table: only fields outside a table are offered;

  • in a table: the columns of that table are offered in addition to the fields outside a table.

â„č Good to know
To use a table column from a Calculation field placed outside the table, use the functions in the ARRAYS category (Sum, Average, Minimum, Maximum).

Functions

The Function button groups the functions by theme, with a search. The technical name of each function is shown below its label: this is what appears in the formula. Place the cursor between the brackets of a function to enter a value or insert a field.

Theme

Function

Role

Arrays

Sum sum()

Adds up the values of a table column

Arrays

Average avg()

Calculates the average of the values of a table column

Arrays

Minimum min()

Returns the smallest value of a table column

Arrays

Maximum max()

Returns the largest value of a table column

Rounding

Round up ceil()

Rounds up to the next integer

Rounding

Round down floor()

Rounds down to the previous integer

Mathematics

Square root sqrt()

Calculates the square root of a value

Mathematics

Power pow(x,y)

Raises x to the power of y

Mathematics

Cosine cos(), Sine sin()

Calculates the cosine or sine of a value

Mathematics

Natural logarithm log(), Exponential exp()

Calculates the natural logarithm or the exponential of a value

Special

Unique identifier unique_id

Generates a value from the date, the time and the user's identifier

Special

Condition if

Returns one value if the condition is true, another if it is false

Special

Cascading conditions ifs

Tests several conditions in order and returns the value of the first true condition

Special

ItemRefNum item_ref_num

Reads the value of a list column, like a Reference field, usually from an NFC Tag or an input field

Building a condition

The If
 button opens a wizard that builds the condition for you, without having to type any syntax. It has three parts:

  • IF: choose a field, an operator (=, ≠, <, ≀, >, ≄, is empty, is not empty) and a value, another field or a text.

  • THEN: result if the condition is true, entered directly or chosen with the Field button.

  • ELSE: result if the condition is false, entered directly or chosen with the Field button.

To combine several conditions, click Add a condition, then choose how to link them:

  • AND: all the conditions must be true;

  • OR: a single true condition is enough.

The corresponding formula is shown above the Insert the condition button. Depending on your choice, AND appears as && and OR as ||.

The screenshot below shows a conditional calculation being prepared with two conditions, linked by AND.

Then click Insert the condition: it is added to the formula with the if function. Here is the result once the condition has been inserted.

Entering a condition manually

You can also write the condition directly in the formula, in the form if(condition, value_if_true, value_if_false).

The wizard only offers one THEN result and one ELSE result. To get a different result depending on which condition is met, enter the ifs function:

ifs(condition1, value1, condition2, value2, 
, value_otherwise)

For example, ifs([Quantity] > 100, [Price] * 0.8, [Quantity] > 10, [Price] * 0.9, [Price]):

  • if the quantity is greater than 100, the price is multiplied by 0.8;

  • otherwise, if it is greater than 10, the price is multiplied by 0.9;

  • otherwise, the price is displayed as is.

The last value (here [Price]) is required: it is the result when no condition is met.

Operators

The table below lists the operators you can use to enter a formula manually. They are also available from the toolbar.

Type

Operator

Role

Arithmetic

+ - * /

Addition (or combining text), subtraction, multiplication, division

Arithmetic

%

Modulo: remainder of a division

Comparison

== !=

Equal to, not equal to

Comparison

< <=

Less than, less than or equal to

Comparison

> >=

Greater than, greater than or equal to

Logic

&&

Logical AND: all the conditions must be true

Logic

||

Logical OR: a single true condition is enough

Logic

!

Logical NOT (to be typed in the formula)

Logic

? :

Ternary condition (to be typed in the formula): (condition) ? value_if_true : value_if_false

Visibility conditions

Three modes are available:

  • Always visible: the field always appears when entering data.

  • Visible if
: the field is displayed only when the conditions you define are met.

  • Always hidden: the field is never displayed during data entry, but remains usable in exports.

For details on setting up conditions, see the Visibility conditions tutorial.

Display & layout

This card customises how the field is displayed in the mobile app.

  • Title colour: choose from the colours offered. The first option, crossed out, means no colour.

  • Field title size: move the slider between Aa (smaller) and Aa (larger). The preview shows the resulting size in pixels (11 px by default). It applies to the font of the title shown on mobile.

  • On the same line as the previous field: this option places the field next to the previous one. It requires enabling the Allow multiple fields to be displayed on one line option in the mobile app settings.

Advanced

  • Read-only when editing: the field stays visible, but can no longer be edited when the record is reopened for editing.

  • Personal data (GDPR): this option flags the field as personal data. Its content is then partially masked in the data history: only the last 3 characters remain visible. Clicking the eye icon shows the data in clear: anyone with access to the data can therefore still view it in full.

  • Word: remove the line if empty: in a Word export, the paragraph containing the field's tag is removed if the field is empty.

    To learn more, see the Block tags and paragraph deletion tutorial.

Technical identifier and tag

Below the advanced options, the Technical identifier field shows the identifier of the field. It is used as-is in calculations and automations.

The tag to use in your custom exports is shown just below: ##calculation1## for example. Clicking the tag copies it.

Tags are always enclosed in two hash signs (##). To customise them to your needs, see the Using tags to customize exports tutorial.

💡 Tip

The technical identifier, and therefore the tag, can only be changed as long as the form has not been saved. It is recommended to customise it before the first save.

Use cases

The Calculation field meets many needs. The following tutorials detail the most common ones:

📚 To go further

Find all the tutorials in the Use case: Calculation collection.

Did this answer your question?