PROBLEM

The addition calculation displays incorrect results in the ArcGIS Survey123 survey forms

Last Published: April 29, 2022

Description

In ArcGIS Survey123 Connect, when performing addition with inputs from multiple fields using the expression below, the calculation result displays incorrect values in the ArcGIS Survey123 survey forms.

${question_one} + ${question_two}

The image below shows an example of an incorrect calculation result for the addition of the total number of rooms and kitchens fields.

Image of the example of the incorrect total value from the sum calculation between an integer and the text data type

Cause

One or more fields in the calculation input are text or string fields. If an addition formula includes a text or string field, the (+) operator concatenates the field values instead of adding them.

Solution or Workaround

Choose one of the methods below to resolve the issue.

Use the number() function in the calculation formula

Note:
The number() function in the formula enables the text or string values in the calculation to be recognized as numbers.
  1. In ArcGIS Survey123 Connect, open the XLS form of the survey.
  2. In the calculation column, insert the field in the number() function in the addition formula. In this example, the following expression is specified in the calculation column:
(number(${question_1})+number(${question_2}))

The image below shows the example of a calculation formula to add up the fields with the text (total_rooms) and integer (total_kitchens) field types in the ArcGIS Survey123 Connect XLS form.

Image of the example of the configured calculation of the total sum between two different data types.
  1. Save and republish the survey form.

Set the data type as int in the bind::type column of the text or string field

  1. In ArcGIS Survey123 Connect, open the XLS form of the survey.
  2. In the XLS form, navigate to the bind::type column of the text or string field.
  3. In the bind::type column, click the cell of the text or string field.
Image of the empty field on the same row as the text or string data type
  1. Click the drop-down arrow and select int.
Image of the drop-down arrow selection
Note:
Alternatively, add a new bind::type column if it is not created by default, and fill in the cell of the text or string field with int.
  1. In the calculation column, fill in the cell of the text or string field with the following expression:
int(${question_1}) + int(${question_2})
Image of the example of the configured calculation result
  1. Save and republish the survey form.

The image below shows the correct calculation result for the addition of the text and integer field values in the ArcGIS Survey123 survey form.

Image of the example of the correct total value from the sum calculation

Article ID: 000024531

Software:
  • ArcGIS Survey123 Connect

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options