Select to view content in your preferred language

Autopopulate Repeat Question Type using Values from Another Repeat Question Type

1008
8
Jump to solution
03-31-2024 07:20 PM
jantolihao
Regular Contributor

Hi, everyone!

I just want to ask if it's possible to autopopulate a repeat question type using the values from another repeat question type. 

For instance, I have here 2 Repeat Question Types: Owners Declaration and Assessment. Please see the reference image below.

jantolihao_0-1711937166918.png

What I want to do is, I want to autopopulate the Machinery Name and Machinery Description fields in Assessment Repeat using the values from Owners Declaration Repeat. Yes, I can call/reference the fields in the calculation. However, I am having issues for multiple records in Owner Declaration Repeat. It does not properly/correspondingly autopopulate the Assessment Repeat. It just autopopulates the first "page" of the Assessment Repeat. Please see reference image below. I have 2 records in Owners Declaration Repeat but in Assessment Repeat, only 1 record is autopopulated. It seems that it only autopopulates what is currently displayed.

jantolihao_1-1711937780494.png

Do you have any hints/ideas in addressing this concern? Thank you in advance.

 

0 Kudos
1 Solution

Accepted Solutions
jantolihao
Regular Contributor

Hello, everyone! Update on this concern. I already addressed this concern. These are the steps that I performed:

1. Inserted a calculate question type that counts the entries inputted by the user in the first repeat (Owners Declaration)

2. The number that will be calculated in No. 1 will be placed in the Repeat Count of the second repeat (Assessment).

3. For the fields in the second repeat (Assessment) that will be auto-populated by the records in the first repeat (Owners Declaration), I used the combination of indexed-repeat and position (..) function in the calculation column. Please see sample calculation entry below.

indexed-repeat (${field name}, ${repeat name}, position(..))

 

Thank you everyone for helping and for providing reference links. 🙂

 

View solution in original post

8 Replies
ChristopherCounsell
MVP Regular Contributor

Put the questions in the one repeat, instead of splitting them in two?

It's a bit difficult to understand the way you have the survey setup but I'd recommend taking a look at these:

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

https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-repeats/ba-p/89804...

 

0 Kudos
jantolihao
Regular Contributor

Hello, @ChristopherCounsell. Thanks for answering. However, I cannot put the questions in the same repeat since 1 repeat will only create 1 related table. The requirement is that there should be 2 related tables: 1 for Owners Declaration and 1 for Assessment. But thank you for the links.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Take a look at 

indexed-repeat(question, repeat, index number)

Returns the value from a specific question in a repeat record. For more information, see Repeats.

indexed-repeat(${room_no}, ${floor}, 3)

 

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm 

jantolihao
Regular Contributor

Hello, @DougBrowning. Thank you for answering. I tried this one. However, I am having issues on getting all records from one repeat then transferring/referencing them all to another repeat. Yes, we can use the floor example in indexed-repeat for specific record corresponding to specific index, say, index 3. But it seems that indexed-repeat does not cater to all records. I'm still not sure though. But thank you for the link.

0 Kudos
ChristopherCounsell
MVP Regular Contributor

Try using position(..) for the current repeat record, with the indexed-repeat value.

e.g. indexed-repeat(${room_no}, ${floor}, position(..))

Theoretically this gives you the indexed-repeat value (room) from table one (floor) at the current index of the second table.

Haven't tried it though, and you may have issues if people change values or go back/forth a lot triggering re-calc, so would really recommend not having a split into the two tables if you can avoid it.

MarikaVertzonis
Esri Regular Contributor

You describe that there needs to be two tables (Owners Declaration and Assessment), but can they be nested? ie: Owners Declaration is table that is related to your primary feature layer, and then Assessment is related to Owners Declaration.

jantolihao
Regular Contributor

Thank you for the response, @MarikaVertzonis. Fortunately, I already addressed this concern. 

0 Kudos
jantolihao
Regular Contributor

Hello, everyone! Update on this concern. I already addressed this concern. These are the steps that I performed:

1. Inserted a calculate question type that counts the entries inputted by the user in the first repeat (Owners Declaration)

2. The number that will be calculated in No. 1 will be placed in the Repeat Count of the second repeat (Assessment).

3. For the fields in the second repeat (Assessment) that will be auto-populated by the records in the first repeat (Owners Declaration), I used the combination of indexed-repeat and position (..) function in the calculation column. Please see sample calculation entry below.

indexed-repeat (${field name}, ${repeat name}, position(..))

 

Thank you everyone for helping and for providing reference links. 🙂