Calculations

Adding Calculations field type allows you to create a simple calculated expression using the predefined list of math, strings, date/time and logical functions and fields as variables. It will help to generate the fields based on the already filled data and make it easier for the end user to add data to the Library.

To add the Calculations, click Mobile: Add button icon, go to Field and choose the relevant option from the list of field types. Type the field name and add the expression:

  • Tap Field to add variables: other fields added to this Library
  • Tap Function to get access to the list of the available functions. All of them are  grouped by the type: math, date/time, strings and logical. The short description is shown under each one to help you choose the most relevant one. To add the chosen function to the expression container, tap it

From the toolbar on the right from Field and Function options, you can Run the expression using the data of any chosen entry or get Help.

On the screenshot above, Calculations field is used to find the total sum spent on some product by multiplying the price of the product and the number of product items purchased. Also, a logical functions is added here: it sets the total to $5.00 if the sum is less than $5.00 to avoid small sums for the general report. So, the expression looks as the following:

if(#{price}*#{quantity}<5,5,#{price}*#{quantity}), where
{#price} and {#quantity} are the fields
#{price}*#{quantity}<5 is the condition
5 will be returned if the condition is True, #{price}*#{quantity} will be returned if the condition is False

More detailed information can be found on the wiki.

Was this article helpful?

Related Articles