Default Repeat Answers

1631
6
01-11-2021 10:17 AM
by Anonymous User
Not applicable

I work for a state agency that collects water quality samples, and currently we have a survey set up to have a repeat where each repeat ("addition" may be a better word)  represents one specific sample bottle. Within this repeat it ask 3 major questions: What is the bottle size and material, what preservatives are added, and which analytes are going to be tested. In some cases we can collect 6+ different bottles. So I am looking into ways to have a set of default answers for a repeat. Or something similar.

I am not opposed to changing the format. But at the moment we are hoping to have a select one question for a specific project, which when answered, can prompt the repeat to have a set of default answers. 

For example, if the select one question is answered for "Horse Creek Study", the repeat will autofill with the bottles/analytes we typically collect for that study. We want to keep a User-defined option if possible, in case we make unexpected changes in the field. 

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

Loading defaults is pretty easy but creating multiple repeats a little harder.

First you can use pulldata to get the number of repeats and stick that in repeat_count.

Then use once(count()) or position(..) to get the index of the repeat.

Do another pulldata using the repeat index to lookup that value for that repeat.

Then a user can overwrite anything they want to change.

See here for more  https://community.esri.com/t5/arcgis-survey123-questions/creating-custom-constraints-for-each-select...

Hope that helps.  Its a bit complicated but it may work.

0 Kudos
by Anonymous User
Not applicable
Thanks for the information! Before I dive real deep into this method, do
you think I would have to make a separate table for each project/bottle
group? I could see that making this pretty difficult to make adjustments to
in the future?

Do you think utilizing something like a Conditional Report Element may be
easier and more user friendly. Creating a site specific Feature Report is
the ultimate end goal, so I could see a conditional report element working
well. Such as adding the information to the already created repeat table in
the feature report depending on how the select one question is answered.


0 Kudos
DougBrowning
MVP Esteemed Contributor

I guess it depends on how many there are.  You could hide whole repeats and have one per type.  I have not used reports really so not sure on any of that.  Sorry.  In these cases I just build both and see how it goes.

0 Kudos
by Anonymous User
Not applicable

Hello Doug! So I tried using your method of using the once(count()) and pulldata() funtions in a test survey, but I am running into some errors. In my test survey I am only trying to pull my container  size/type information, using the repeat_count method that both refer to my sample_suite.csv

First, whenever I try and load the survey it tells me there are Dependency Cycle errors, that I narrowed down to the pulldata() calculation in my ${container} question. 

Second, the repeat_count only seems to work properly for 2 of 4 Study's in my ${sample_suite} question. 

 

I'll attach both files below. Thank you for your help!

0 Kudos
RobertAnderson3
MVP Regular Contributor

Hi Doug,

I got this solution working beautifully and I gotta thank you for that!

My only issue with it is I noticed with the way repeat_count is set up that it makes the count set in stone, where the user can't add or remove repeats as needed, if they're short-handed one day or have an extra person working with them, is there a way to make the repeat_count have a default value from that calculation but still be flexible? 

Thanks!

0 Kudos
DougBrowning
MVP Esteemed Contributor

No a set repeat count is a set count.  I have had other issues with repeat count since it preloads all the repeats sometimes the calcs get messed up. 

So now what I do is set a constraint or a a note warning based on the count from position(..).  A made a font red note that warns them they have say gone to far or have not collected enough points.  So it is a soft stop like you want.  You can show a warning or have a question appear when the count is too much or little and have them log why it is low (like being short handed).  This method has worked better than repeat count in a number of forms.

For another project we added a question at the top of each repeat that asked Did you collect this location? That would hide or show the fields.  Seems weird but it worked great for projects when they collect at set intervals but sometimes hit an area they can not access.  So they can just hit Not Accessible and move on to the next repeat.

Hope that helps

0 Kudos