DateTime now() not updating when "edit and resend" from the SENT box

678
3
Jump to solution
11-09-2021 10:52 PM
SpatialSpeedy
New Contributor II

Hi all!

 

I am creating a survey workflow that leverages Collector and Survey123.

 

The survey is designed to work overtime(call it 2 years) where users carry out inspections (up to 7 times) over this time period. This is in a forestry context where inspections are done on a tree and branch level. To accommodate this tree/branch level we make use of REPEATS.

 

Originally the survey was setup where the user would select an activity and capture the relevant data with the datetime being captured using the now() calculation. However there was a great deal of data duplication as the users were not able to visualize the previous data collected on the form which lead to double captures of the same activity.

 

This led to a change in design to only allow updating from the SENT items where the previously captured data could be seen. The issue being that the now() calculation only fires once when the form or REPEAT is created and not when users "edit and resend" the same form. A work around would be to allow users to manually change the time to the current time, however there can be upwards of 250 branches so this is not a possibility. 

I should mention the reason we are wanting the time to change with each update is that we have a SQL script pulling these times and pushing them into a results table which runs daily. We cannot exclusively use the "GDB_FROM_DATE" field as this only captures the PUSH datetime of the entire capture and not the per branch time. 

 

Any help would be greatly appreciated. 

 

 

  

0 Kudos
1 Solution

Accepted Solutions
SpatialSpeedy
New Contributor II

Ok I figured it out, pretty simple.

Instead of using datetime with the now() calculation, rather use the field types "start" & "end" on your main form. Then setup a calculation using the "end" on a datetime field in your repeat. By default the start and end field types are hidden. I have tested this and it works offline using the survey123 field.  Illustration below.

SpatialSpeedy_0-1636638469820.png

The start field type will be once off when the form is created, however the end will become the date the form was last captured on.

  

 

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

Are users doing this in the web app or field app?

If the web app is being used, the most recent update included the recalculate URL parameter. Including recalculate=field:<some-field-name>,field:<some-other-field> will force the survey to re-run the calculations for the fields specified. So you can have your survey link go to "some-survey-link...&recalculate=field:date-field".

- Josh Carlson
Kendall County GIS
0 Kudos
SpatialSpeedy
New Contributor II

Hi Josh,

I forgot to mention, the field app is being used. So this is an offline workflow.

We are utilizing Collector offline to do the initial Survey123 launch using the "&field:GUID={GlobalID}" so we can get the tree positioning, this is a once off per tree since we then update the branch information via REPEATS per activity. 

Correct me if I am wrong but the URL parameter wouldn't be viable since this only gets executed when launching the survey from collector, when the idea is to update the SENT items. 

The only option I see is for the user to manually update the datetime for the tree when they are capturing a new activity, so all branches get the same time for a certain activity. 

 

0 Kudos
SpatialSpeedy
New Contributor II

Ok I figured it out, pretty simple.

Instead of using datetime with the now() calculation, rather use the field types "start" & "end" on your main form. Then setup a calculation using the "end" on a datetime field in your repeat. By default the start and end field types are hidden. I have tested this and it works offline using the survey123 field.  Illustration below.

SpatialSpeedy_0-1636638469820.png

The start field type will be once off when the form is created, however the end will become the date the form was last captured on.