Why is date constraint not working?

2672
7
Jump to solution
09-21-2016 11:44 AM
SarahMayhew
New Contributor

In Survey123, I have a constraint set up on a date question to restrict the reported date of harvest to be between a minimum and maximum date where the minimum and maximum date are determined by the season of harvest.  The constraint was working appropriately in earlier versions of Survey123, but the constraint no longer works since the latest update.  I'm running Survey123 Connect version 1.7.35 and Survey123 1.7.20 on an iPhone.  The survey allows me to enter and save any date regardless of whether it falls between the min and max dates or not.  A simplified version of the design of the min and max dates is:

I use the max1 and min1 variables in the constraint for the harvest date:

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

Thanks Sarah, having the XLSFile helped a lot. I was able to reproduce the issue in 1.7. Will do our best to fix this as soon as possible. Stay tuned for the 1.8 announcement.

By the way, it looks like you could really benefit from the newly added pulldata function. See the help topic here: Formulas—Survey123 for ArcGIS | ArcGIS    With pulldata you can really simplify your calculate expressions removing the concatenated if statements and replacing them with pulldata expressions. Just an idea.

View solution in original post

7 Replies
IsmaelChivite
Esri Notable Contributor

Hi. Would you please share your XLSForm? You can attach it to your response by using the 'Advanced Editor'. If for any reason you do not want to share the XLSFile in this thread, please open an Esri Technical Support incident so we can look at it. Thanks!

0 Kudos
CarmelConnolly
Esri Regular Contributor

Hi, 

I've noticed this as well. In our scenario, a re-audit date was constrained to within 2 months of the audit date:

My constraint field is called ${DueDate}, is based off of the AuditDate field (default is today()) and is set to:

.>date(${AuditDate}) and . <date(${AuditDate}+ (60.88*24*60*60*1000))

The constraint worked perfectly in Survey123 Connect & Survey123 1.6.11 but not in 1.7.35/1.7.20.

0 Kudos
DerekLaw
Esri Esteemed Contributor

Hi Carmel,

Thanks for bringing this to our attention. I was able to repro your issue in Survey123 Connect v1.7.35 as you described and confirmed that it worked in the previous v1.6 release. We'll work to address this item for the v1.8 release.

@Sarah: If you could please provide your XLSForm, we can look into your issue further. Or, please open an Esri Tech Support issue.

Hope this helps,

0 Kudos
SarahMayhew
New Contributor

I have attached an .xlsx with the relevant rows for harvest season and date.  Thanks for looking into this.  

0 Kudos
IsmaelChivite
Esri Notable Contributor

Thanks Sarah, having the XLSFile helped a lot. I was able to reproduce the issue in 1.7. Will do our best to fix this as soon as possible. Stay tuned for the 1.8 announcement.

By the way, it looks like you could really benefit from the newly added pulldata function. See the help topic here: Formulas—Survey123 for ArcGIS | ArcGIS    With pulldata you can really simplify your calculate expressions removing the concatenated if statements and replacing them with pulldata expressions. Just an idea.

SarahMayhew
New Contributor

Ismael - Thank you for looking into the fix for the date constraints.  I have tried the pulldata function, but I'm not sure if it's going to work.  Since the date constraint isn't working, I can't give it a proper test, but the attached .xlsx and info.csv give me errors.  If I remove the date function from rows 8 and 9 in the .xlsx and simply tell it to display ${max1} and ${min1} then it works fine.  But it doesn't seem to like converting them to dates.

0 Kudos
IsmaelChivite
Esri Notable Contributor

Attaching slightly modified XLS file. Tested on 1.8. I hope it works for you.

0 Kudos