DateTime now() not working for second survey

2664
14
Jump to solution
10-21-2021 06:34 AM
FredMitchell
New Contributor III

I have two survey's that respond to one hosted feature service. One is a request that is submitted in the browser and the other is how inspectors respond to that request using the app. The now() on the DateTime field for the request works but it doesn't work on the inspection side in the Survey123 app. Please let me know if this is a bug or if I have something wrong with my code. Thanks!

0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @FredMitchell

I don't think this is so much an IOS 15 issue I can reproduce on my Android device and on an IOS 14 device. I had also tested with 3.12 and was able to reproduce with that version as well. I think the issue is more so around calculations not triggering when opened via the inbox. We have an enhancement (ENH-000134563) logged to enable calculations to always work on load from the inbox which I think would address this issue. One workaround would be to add a simple yes_no choice question at the beginning of the form and make the inspection information group relevant based on 'yes' being selected. Making the group relevant will trigger the calculation when the survey is opened from the inbox. I've attached a slightly modified Mosquito Control form for reference. 

Thank you,
Zach

View solution in original post

14 Replies
ABishop
MVP Regular Contributor

@FredMitchell 

Try reading up on the way the time works in Survey123 here:

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

 

Amanda Bishop, GISP
0 Kudos
FredMitchell
New Contributor III

I read the article but still am arriving at the same problem. The article states:

"Survey123 accepts three possible values in the XLSForm default column:

  • now()  This function returns the current time in your device. Typically you apply this function to questions of type datetime."

I have placed this expression in the default column of the unique DateTime fields for both surveys and it's oddly not auto populating for the second one.

0 Kudos
ABishop
MVP Regular Contributor

@FredMitchell 

When you test both of these forms are they from the same device and using the same connections, etc? Seems as if one is from a browser and the other is from an inspector response, could be the connection or device the problem?

Maybe try changing the inspector form to choose the time and date manually instead of autocalculating it.

Amanda Bishop, GISP
FredMitchell
New Contributor III

That's an interesting observation. I tried the inspector form in the browser and the now() function worked. It is likely that this is a bug with capturing the device time from iOS 15. Inspectors are currently populating the field manually ever since now() stopped working.

ABishop
MVP Regular Contributor

@FredMitchell 

If there is a bug, ESRI has it documented.  I did a search for you here... maybe you can find something:

https://support.esri.com/en/Search-Results#search?q=iOS%2015&content-type=Bugs 

Good Luck!

Amanda Bishop, GISP
FredMitchell
New Contributor III

Thanks! I wasn't aware of the bug tracker page. I may submit a support ticket in case this is a bug and hasn't been logged yet.

ABishop
MVP Regular Contributor

@FredMitchell 

You're welcome!  Hope this helps.

Amanda Bishop, GISP
0 Kudos
ZacharySutherby
Esri Regular Contributor

Hello @FredMitchell

I don't think this is so much an IOS 15 issue I can reproduce on my Android device and on an IOS 14 device. I had also tested with 3.12 and was able to reproduce with that version as well. I think the issue is more so around calculations not triggering when opened via the inbox. We have an enhancement (ENH-000134563) logged to enable calculations to always work on load from the inbox which I think would address this issue. One workaround would be to add a simple yes_no choice question at the beginning of the form and make the inspection information group relevant based on 'yes' being selected. Making the group relevant will trigger the calculation when the survey is opened from the inbox. I've attached a slightly modified Mosquito Control form for reference. 

Thank you,
Zach
FredMitchell
New Contributor III

Hi @ZacharySutherby,

Thank you for your thorough response to my question. I didn't realize that when a form is loaded from the inbox it's treated differently than if it's opened in the browser. I see what you did there with addition of the prior question making the group relevant depending on the response to that question. It's a neat idea but I think for now I'll keep the now() expression in the calculate column instead of the default one. Whether it's in calculate or default it works once the user taps on the DateTime field but I like that when it's in calculate it gives the refresh option icon to the right of the field. From a UI/UX standpoint it's a little more intuitive for our field workers since it's an actual icon for them to click. Also, one of the downsides of having the group be relevant is that if they select no on start survey they could possibly still go through and submit the survey but bypass the first group of questions which is a risk I'm hesitant to take.

In regards to the ENH-000134563 enhancement is there an estimated idea of which future release this would be included in? Thanks again for your time! I really appreciate it.

Respectfully,

Fred