Individual Date Constraints Based on Relative Date Range(s)

08-23-2019 01:39 PM
New Contributor

I need to apply a date constraint filter for RELEVANT dates in a survey. We have end users going on trips lasting a day to weeks. We do not know the range of dates upfront. From that initial date range, the user needs to respond to questions about activities for each day, within the date range, including start and end dates, thus, they need to enter another date (in a repeat with a bunch of other questions) based upon the activities conducted for that particular day. 

Im having trouble writing something simple (.>=startdate and .<=enddate) for a constraint for the trip start and trip end dates. Currently, it will take values within a range of dates, including start date, but it will not accept entries on the same day, or the end day. There are many instances the start and end dates are the same. To gain efficiency, if the start and end dates are the same, it will populate in the survey, but the constraint does not allow submission. So I found some help articles.

In the technical support write-up How To: Apply a constraint on a date question in Survey123 Connect for ArcGIS, it gives good advise on how to address this by using calculates, but with static date ranges. When I apply the field names (startdate/enddate) to their example constraint/calculation fields, it does not work (could be my lack of understanding/syntax). Can we apply a simple constraint to this, or do we have to use the example listed above, and build in calculates to make this happen? If so, how would the example calculate look based off the initial start and end date question?

I need to be able to have the end user enter a date on or between the range of dates for their trip. I have attached a simple example of my survey. I have included what I originally created (blue row), and also included the example the technical article addressed (green row) but only made the date range for Aug 2019. 

am stuck, any help is appreciated. 

Thank you! Chris


0 Kudos
1 Reply
Esri Esteemed Contributor

Hi Chris,

I'm not sure I see an issue with the XLS file regarding constraints. There is a small issue in the question with relative date comparison where you have both a calculation and a default value; the default value will always be overridden by the calculation, so I would suggest:

if(${startdate}=${enddate},${enddate}, today())

(Note the use of today() as you are dealing with date, not date-time).

0 Kudos