Recording time in two separate fields in Survey123

05-31-2017 11:29 PM
Occasional Contributor II


I'm designing a survey which users will need to complete in 2 parts, at 2 separate times. I need to record the time of completion for both parts, and if possible I would like for the date and time to automatically populate.

However - if I use now() as the default value for the fields, the time set at first completion is then overriden by the time of second completion.

From speaking to an ESRI trainer earlier in the week, it *may* be possible to set a conditional calculation on the first field (ie 'if ${datetime1} is empty, now(), ignore') however I'm struggling with syntax to make this happen.

Has anyone encountered a similar problem or could offer some suggestions on how I can solve this issue?

Thank you in advance.

0 Kudos
2 Replies
Esri Esteemed Contributor

Hi Anthony,

Have you considered using 2 forms against the same feature service, one for each collection period?  Here's how I would create it:

1) Create a form with all of the questions of your survey and publish it.  This creates a feature service with all of the questions

2) Create a new form using the from 'a Feature Service' option, selecting the service created in 1.  This will recreate the survey, with the addition of setting the form to post to the existing feature service created in 1.  Remove the questions that are relevant to only the second collection period.  You'll need to change a few things, like the start question from a generic date time to start

3) Create the form for the second collection period as you did in Step 2.  This form will need to have editing enabled so as to be able to load the form data submitted in the first collection period.

That being said, I can think of a couple of issues that might prevent this from working, depending on the specific needs of your survey.

Occasional Contributor II

Gday James, thanks for taking the time to reply.

Unfortunately in this circumstance, I don't think the two survey approach will work, as users will be working predominantly offline and out of mobile range.

However, I had a play yesterday with removing the default now() value, leaving it to the user to manually set date and time. On iOS, as soon as the date is set, the time seems to autopopulate correctly. I am yet to test this on an Android device though.

So my solution will be to remove the default value, and leave it to the user to set. The second part of the survey will be hidden behind a conditional question, and will only be exposed once the condition is met. Finally I'll have the users save the first survey entry as a draft, and then finalise the same survey for completion once they are ready.

0 Kudos