Prefill Question(s) in repeat with answers from previous record

858
4
11-11-2021 08:49 AM
DerrickWestoby
Occasional Contributor III

Good Morning, 

I have a survey form for collecting samples from buildings.  The samples are contained within a repeat ( ${repeat_samples} ).   Within the repeat, I have fields for Building Number, Floor Number & Room Number.  Since multiple samples are always taken from each room, I would like NEW samples to default to the Building, Floor and Room values entered in the previous record.  This is the formula that I've tried using, but receive a dependency cycle error: 
indexed-repeat(${bldg_num}, ${repeat_samples}, position(..)-1)

DerrickWestoby_0-1636649248486.png

 

Any help greatly appreciated. Thanks

 

 

0 Kudos
4 Replies
by Anonymous User
Not applicable

Hi @DerrickWestoby,

I believe what you are seeing is expected, as you are using a calculation that references a question that uses the answer to calculate itself, hence the circular reference. This is generally an issue with indexed-repeat functions if you use them inside the repeat that it is referring to. For the November update, we plan to update the documentation to say that using indexed-repeat inside a repeat it refers to is not supported.

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformrepeats.htm#ESRI_SECTION1_F3E28755...

Can you share your XLSForm and media folder so I can take a look and see if there is a better way to do what you are trying to achieve?

Regards,

Phil.

0 Kudos
DerrickWestoby
Occasional Contributor III

Thanks for the response, Philip.   I'm not attached to this specific way to accomplish the goal, just the goal itself.  If there's another way to make a question's default answer match the input from the previous record in the repeat, I'd love to hear that! 

I sent you a message with my XLS as well.  Thanks for taking a look. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

I have only got 1 way to work but it only works on small repeats.  See here  https://community.esri.com/t5/arcgis-survey123-questions/prepopulate-answers-in-a-repeat-with-last-v...

 

0 Kudos
DerrickWestoby
Occasional Contributor III

Thanks Doug.  I may try this in a test version of the XLS, but not too fond of the javascript implementations based on experience and if you're already reporting it struggles with large surveys.  The surveys I have in use with javascript running are much less stable already. 

0 Kudos