HOW TO

Apply constraints on multiple date and time questions in ArcGIS Survey123 Connect

Last Published: June 10, 2022

Summary

Applying a constraint to a date and time questions in ArcGIS Survey123 sets a restriction on the input within a certain range. It is used when a logical requirement is required to guide respondents, or limit potential input errors in the survey form.

This article provides the steps to define constraints and calculations that confine respondents to inserting valid dates within the specified hunting season and the start and end time during the day. The image below displays an ArcGIS Survey123 Connect survey form with multiple date and time questions.

An example of the ArcGIS Survey123 Connect survey form

Procedure

Note:
The workflow below utilizes the date constraint for the wild turkey hunting season between 9/15/2019 and 11/14/2019 as an example.
  1. Open the ArcGIS Survey123 Connect XLSForm.
  2. Define the minimum and maximum date for the first date question as below:
    1. Create two calculate questions under the type field, and provide a name for both the questions under the name field. In this example, MINDATE_T is used for the first question and MAXDATE_T is used for the second question.
    2. Under the calculation field, specify the following formula:
    • For the MINDATE_T question:
if(1=1, '2019-09-15', if(1=0, '0000-00-00','1111-11-11'))
  • For the MAXDATE_T question:
if(1=1, '2019-11-14', if(1=0, '0000-00-00','1111-11-11'))
The XLSForm with two calculate question types created, and the specified calculation formula
  1. Create the first date question under the type field, and provide a name for the question under the name field. In this example, Hunting_date_T is used.
  2. Under the label field, enter the question text to be displayed in the survey form.
  3. Specify the following formula under the constraint field.
.<=date(${MAXDATE_T}) and .>=date(${MINDATE_T})
The XLSForm with the first date question type created, question text entered, and the specified constraint formula
  1. Define the start and end time for the first group of the time of day questions as below:
    1. Create two time questions under the type field, and provide a name for both the questions under the name field. In this example, Hunting_time_start_T is used for the first question and Hunting_time_end_T is used for the second question.
    2. Under the label field, enter the question text to be displayed in the survey form.
    3. Specify the following formula under the constraint field for the Hunting_time_end_T question.
.>${Hunting_time_start_T}
The XLSForm with the first group of two time question types created, question text entered, and the specified constraint formulas
  1. Create the second date question under the type field, and provide a name for the question under the name field. In this example, Hunting_date_T2 is used.
  2. Under the label field, enter the question text to be displayed in the survey form.
  3. Specify the following formula under the constraint field.
.<=date(${MAXDATE_T}) and .>=date(${MINDATE_T}) and .>${Hunting_date_T}
The XLSForm with the second date question type created, question text entered, and the specified constraint formula
  1. Define the start and end time for the first group of the time of day questions as below:
    1. Create the second group of two time questions under the type field, and provide a name for both the questions under the name field. In this example, Hunting_time_T_start2 is used for the first question and Hunting_time_T_end2 is used for the second question.
    2. Under the label field, enter the question text to be displayed in the survey form.
    3. Specify the following formula under the constraint field for the Hunting_time_T_end2 question.
.>${Hunting_time_T_start2}
The XLSForm with the second group of two time question types created, question text entered, and the specified constraint formulas
Note:
If a different date range is required, create two new calculate type questions with a different name. Enter the minimum and maximum dates accordingly in the calculation field. For the new date question, reference the two new calculate questions when defining the constraint formula.
The XLSForm with a different two calculate question types created, and the specified calculation formula with a different date range
 

Article ID: 000027750

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