Default Repeat Answers

124
4
01-11-2021 10:17 AM
TristonRice
New Contributor II

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. 

Reply
0 Kudos
4 Replies
DougBrowning
MVP Frequent 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.

Reply
0 Kudos
TristonRice
New Contributor II
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.


Reply
0 Kudos
DougBrowning
MVP Frequent 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.

Reply
0 Kudos
TristonRice
New Contributor II

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!

Reply
0 Kudos