HOW TO

Apply a constraint on a date question in ArcGIS Survey123 Connect

Last Published: May 9, 2022

Summary

Applying a constraint to a date question in ArcGIS Survey123 allows users to limit the input within a certain range. This is useful when the input value must meet a specific requirement. For example, when inserting the reported date of harvest as the input, the date must fall within the harvest season.

Procedure

The following instructions describe how to apply a constraint on a date question in ArcGIS Survey123 Connect:

Note:
The workflow below sets the date constraint between 8/1/2019 and 9/30/2019.
  1. Create two new calculate questions; one for the minimum date and another for the maximum date.
  2. Name the first question, for example, MINDATE, in the name field.
  3. Name the second question, MAXDATE, in the name field.
  4. For the MINDATE question, enter the following string into the calculation field:
if(1=1, '2019-08-01', if(1=0, '0000-00-00','1111-11-11'))
  1. For the MAXDATE question, enter the following string into the calculation field:
if(1=1, '2019-09-30', if(1=0, '0000-00-00','1111-11-11'))
Insert the scripts into the 'calculation' field
  1. Create a date question.
  2. Enter the following string into the constraint column for the date question:
.<=date(${MAXDATE}) and .>=date(${MINDATE})
  1. Enter a message in the constraint_message column, such as "Please enter an appropriate harvesting date". Survey participants can only submit the survey if the date falls between 8/1/2019 and 9/30/2019.
Create a 'date' question and insert the given script in step 7 into the 'constraint' field.

Article ID: 000015409

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