Prevent overwriting existing repeats

1291
5
Jump to solution
08-21-2019 09:38 AM
AllenDailey1
Occasional Contributor III

Hi there,

I'm developing a survey, using Survey123 Connect, that includes a few repeats.  The situation is that there will be one survey instance per location; the first person to visit that location would fill out part of the survey, and follow-up visitors would fill out other parts of the survey, mainly repeats; the portion of the survey entitled "Follow Up Visits" is a repeat.  This way, there can be any number of follow-up visits to the location, and each follow-up visit goes into its own instance of the repeat.

My question is: Is there any way of preventing or deterring users from accidentally overwriting an instance of a repeat that has been filled out by a previous user?  

The first person to do a follow-up visit will fill out the first instance of the repeat, which is already open in front of them when they open up the survey.  That's fine.  But the second person to do a follow-up visit will open up the survey and have that first repeat in front of them, and it will be very likely that they'd forget to scroll all the way down and hit the "+" icon to open up a new instance of the repeat.  I think it would be likely that they would accidentally add to the previous user's repeat instead. (Even my coworkers and I, the survey creators, have fallen into that trap when testing out the survey ourselves!)

I've done a lot of brainstorming and haven't come up with anything very good.  Here are some of my unsatisfactory ideas:

  • Put a question in the beginning of the repeat: "Is this a NEW follow-up visit?"  If user's answer is yes, then: "Scroll down and click the '+' to begin a new follow-up."  This wouldn't work because the user would see the same question at the top of the new repeat even after they click '+', over and over forever.
  • Move the '+' icon to the top of the repeat rather than keeping it at the bottom (my organization doesn't have the Developer Edition license that you need to get into the source code).
  • Format text with html to create some kind of large-font, red text blurb at beginning of repeat that says, "Are the questions below already filled out? If so, click the '+' to start a fresh follow-up!"  This could work but would be rather tacky.

Thanks for reading!

Allen

0 Kudos
1 Solution

Accepted Solutions
BrittneyGibbons1
Occasional Contributor

Hi Allen,

I think the bind::esri:parameters column should be able to help you out in this situation. If I understand your workflow correctly, you would set it to allowAdds to be true and allowUpdates to be false. I think you would also want to allow the data to be queried if they need to review the data entered by previous users. This would at least prevent users from overwriting existing data, but I guess it wouldn't prompt them to add a new record to the repeat. There might be a way to use the count of the repeat to know if the user has incremented the repeat so that you can a note that is removed once the repeat has been incremented. If they don't need to see the previous followups, I believe you could set the query parameter to false and then they would only see a blank repeat. 

From: Prepare for editing existing survey data—Survey123 for ArcGIS | ArcGIS 

Parameters that can be applied to repeats through the bind::esri:parameters column on a begin repeat question type include the following:

  • query—Allows records to be queried and downloaded to the related table.
  • allowAdds—Allows new records to be added to a repeat when editing. The default is true. It can be set to false using allowAdds=false.
  • allowUpdates—Allows existing records in a repeat to be updated when editing. The default is false. It can be set to true using allowUpdates=true.
  • orderBy—Specifies the order of related records by fields.

View solution in original post

5 Replies
BrittneyGibbons1
Occasional Contributor

Hi Allen,

I think the bind::esri:parameters column should be able to help you out in this situation. If I understand your workflow correctly, you would set it to allowAdds to be true and allowUpdates to be false. I think you would also want to allow the data to be queried if they need to review the data entered by previous users. This would at least prevent users from overwriting existing data, but I guess it wouldn't prompt them to add a new record to the repeat. There might be a way to use the count of the repeat to know if the user has incremented the repeat so that you can a note that is removed once the repeat has been incremented. If they don't need to see the previous followups, I believe you could set the query parameter to false and then they would only see a blank repeat. 

From: Prepare for editing existing survey data—Survey123 for ArcGIS | ArcGIS 

Parameters that can be applied to repeats through the bind::esri:parameters column on a begin repeat question type include the following:

  • query—Allows records to be queried and downloaded to the related table.
  • allowAdds—Allows new records to be added to a repeat when editing. The default is true. It can be set to false using allowAdds=false.
  • allowUpdates—Allows existing records in a repeat to be updated when editing. The default is false. It can be set to true using allowUpdates=true.
  • orderBy—Specifies the order of related records by fields.
AllenDailey1
Occasional Contributor III

Brittney,

Thank you so much!!! It works!  In the esri::bind:parameters column, in the "begin repeat" row, I wrote:

allowUpdates=false allowAdds=true query

And that is allowing a user (me) to fill out a new repeat but makes the already-completed repeat non-editable.

A side-effect of this is that the very first instance of the repeat is a throw-away; it can be filled out by the very first survey user only.  If they do not fill it out (which they won't, because this repeat is only for follow-up visits), then it remains empty forever and the second visitor (who does the first follow-up visit) has to skip that first empty repeat and start a fresh repeat.  I don't think this is a big problem for us, though; it's worth the benefit of preventing users from overwriting each other!

Thanks again!

Allen

0 Kudos
by Anonymous User
Not applicable

Allen,

There might be a way to control these "extra" records from happening. It depends on which version of the Survey 123 applications you are using for both "Survey123 Connect" and "Survey123 Field app". If you are using the most current version (release this summer), then give this a try. Within the "appearance" column of the "begin repeat" choose the option for "minimal". This should collapse the repeat and not create a record until the end user taps on the circle with a  plus sign inside of it.

I am using the BETA app version for Survey123, but I believe this is available within the latest release. Give it a try and see what happens.

Good Luck!

Mike

AllenDailey1
Occasional Contributor III

Thanks, Mike!  I set the appearance to minimal and it solved the problem!  

Before, I'd had the appearance as "compact." It's interesting that these two appearances are very similar yet have very different effects.

0 Kudos
by Anonymous User
Not applicable

Yes it is and you're welcome!

0 Kudos