SUM/CONTAINS Functions: Calculations in Tables

You can calculate fields in a table.
For example, you can perform the following calculations.

  • Place calculated fields in a table and perform calculations in each row
  • Use SUM function to calculate the total of numeric values in the table
  • Use CONTAINS function to determine if the table has any row data that matches the search string (specified content)

This page explains these three calculations.

Place Calculated Fields in a Table and Perform Calculations in Each Row

You can place calculated fields in a table and perform calculations in each row.
For example, by using the quantity and the unit price in the table, you can set the formula "Volume*Unit_price" in the calculated field.

Sum Function: Calculating the Total of Numeric Values or Time Data in a Table

By using SUM function, you can calculate the total of values in the fields within a table.

Using SUM Function

For "Number1", specify the field code of the Number field, a formula that results in a numerical value, or a number.

Formula Example

Formula (calculate subtotal): SUM (subtotal)

Calculate the total of numeric values entered in the "Subtotal" fields in the table.

Example: Summarizing the Subtotals in the Table

This section describes how to display the sum of subtotal values in the table into the "Total amount" field, by using an example of an order management app.
For details on tables, see the "Adding Tables into Forms" page.

  1. From the parts list shown in the left side, drag and drop the Calculated field.

  2. Open the screen to set the Calculated field, and enter "Total Price" as the field name.
    Keep the screen open.

  3. Enter the SUM function that calculates the total amount of values in the table.
    In this example, enter "SUM(Subtotal)" to calculate the total amount of subtotals.

  4. To make the total amount easy to read, select "Number with thousands separator (1,000)".

  5. Change the field code to "Total_Price", and click Save.

  6. Click Save Form on the upper left side of the screen, and then click Update App on the upper right side of the screen.

Now, the Calculated field to display the total amount of values in the table is set. Calculated field is set

The sum of subtotal values in the table is displayed in the Total Price field. Sum of subtotal values

TIPS: If Empty Fields Are Included

You can summarize the values even if empty fields are included in the calculation. The calculation result is reflected in the total amount as well. Sum of subtotal values

Example: Calculate the Total of Time Data in the Table

In the Calculated field, you can calculate Date & time, Date, Time, and Hours in addition to numbers
For example, you can set "End-Start" formula, to automatically calculate the time taken to respond to an inquiry
Calculating response time

You can also set a formula "SUM(Response_Time)" in the "Total Response Time" field, to sum up the time taken to respond to customers. Formula to sum up response times Total response times

CONTAINS Function: Determining if Table Contains Any Row Data That Matches the Specified Condition

By using CONTAINS function, you can check if the table has any row data that matches the search string (specified content), and refer to the result in the formula.

Using CONTAINS Function
CONTAINS(Field_code, Search string)

It returns TRUE if the table contains any row where the field value specified in "Field_code" matches the string specified in "Search string". Otherwise, it returns FALSE.
  • As the first argument, specify any of the text, radio button, drop-down, and lookup (if the data type of the copy source is a string) in the table.
  • As the second argument, specify a search string.

Formula Example

This section shows you an example of a formula using CONTAINS function.

Formula: IF(CONTAINS(priority, "speedy"), "Immediate response", "normal")

Determine if the table contains any row whose value is "speedy" by using CONTAINS function.
If the table has at least one row containing "speedy" in the "priority" field, it will display "Immediate response". Otherwise, it will display "normal".
The string for the second argument must be enclosed with double quotation marks ("").