Select to view content in your preferred language

Updating repeat records when the form is submitted

180
3
Jump to solution
10-09-2024 04:53 AM
KatieQuantrell
Occasional Contributor

Hi, 

I have created a Survey123 form to collect survey data for several points along a transect. The data for each survey point is held within a repeat in the survey and general information about the transect is held outside of the repeat. To aid output data usability I am pulling all the generic transect information fields into the repeat table in AGOL.

For the time that the transect was completed ('End Time') however as this field is only filled in within the form once the last survey point has been collected, it is appearing blank in the data submitted for all the point records in the repeat apart from the last repeat record. I assume this is due to the fact that the 'End Time' field will be blank when the first set of repeat records are added, but the final record is created on submission of the form (i.e. once there is data in this 'End Time' field). 

Is there a way to auto update the earlier records in the repeat with the data entered within the 'End Time' field once this has been populated? Without having to go back through all repeats to manually edit them. Resulting in this field being populated for all repeat records once this data is submitted, not just the last repeat record. 

Many thanks for any help/advice

0 Kudos
1 Solution

Accepted Solutions
DuncanC
Frequent Contributor

The root of your problem is copying data from the parent table to the child table 'to aid output data usability', I get why people do this, but IMO it's a bad practice and should be avoided unless you really can justify why it's worth it in a particular case.  

If you instead just access the data from the parent and don't try to have duplicate data in your child table that would solve your problem. 

The alternative is a script that updates the child records once the end time is available.

View solution in original post

3 Replies
DuncanC
Frequent Contributor

The root of your problem is copying data from the parent table to the child table 'to aid output data usability', I get why people do this, but IMO it's a bad practice and should be avoided unless you really can justify why it's worth it in a particular case.  

If you instead just access the data from the parent and don't try to have duplicate data in your child table that would solve your problem. 

The alternative is a script that updates the child records once the end time is available.

KatieQuantrell
Occasional Contributor

Many thanks for your reply, we've now written a script to update the records on AGOL. 

0 Kudos
abureaux
MVP Frequent Contributor

it is appearing blank in the data submitted for all the point

This is expected. Repeats only run calculates for the active item. If you manually scroll back through the repeat, you will see that the calculate fills in. No way to chance that behaviour just now, unfortunately.

I am pulling all the generic transect information fields into the repeat

This shouldn't be necessary. As the common data is stored in the primary table, it is already associated with the repeats. If you need to pull data from the parent table into a repeat item within a Feature Report, you can use dot notation. E.g., Instead of pulling ${username} from the main table into a repeat, you can just use something like ${PARENTLAYER.username}. To get PARENTLAYER, open Connect and go to the "Schema" tab. The "Layers/Tables" column has the names you need.

Is there a way to auto update the earlier records in the repeat

No. See first point above.