Nested indexed-repeat to access response from main repeat group and repeat inside that main repeat group

Dear Kobo and ODK Friend,
I want to access responses in repeat group and a repeat inside repeat group. I have a scenario that there are main types of work (main repeat group) under which other work types come (nested repeat), and by accessing those responses (main work and sub-work) I want to ask another related questions in another nested repeat group. Since I am new user, I cannot upload the part of questionnaire here. If said, I will be uploading.

Your help is sincerely regarded.

Best regards,

Raj Pravat

Welcome to the community @Raj_Pravat! You should be able to upload your file now. But please try to be specific with you issue so that the community could provide you support if it’s doable with KoBoToolbox.

Hi Kal_lam,

Thanks for the response. Please find the attached form which is subset of my survey.Nested indexed-repeat.xlsx (10.4 KB).
I am struggling for couple of days to access the response of nested repeat group question using nested indexed-repeat function through the same position (…) of repeat group and nested repeat group.
I hope I tried to make my query clear to you.

Looking forward to seeing message from you.

Best regards,
Raj Pravat

Would you mind having a look at the post discussed previously (it should help you solve your issue):

Thanks for the prompt follow-up.

This is my first time I wanted to use nested indexed-repeat in nested repeat group in same position(…). Previously I have several times used indexed-repeat in repeat group of one level…

Please let me know if anything that I have to make clear to you.
Kind,
Raj Pravat

Could you clearly explain what is required with a possible example so that it would be easy for the community to better understand your issue.

Wondering that, what other details should I place here! I am using Kobo for more than three years.

Say, Ram and Shyam … Hari (repeat group) are a frequent visitors of many tourist places. A roaster of visitors’ names (main repeat group) and their visited places (nested repeat) is expected to be collected first for the ease of remember and follow them in next questions.

To collect the details of their corresponding visit as of entered in main repeat group and nested repeat group, another repeat group and nested repeat group are needed. For this regard I need to use indexed-repeat to access corresponding names and visited places; name from main repeat group and visited places from nested repeat group to ask further questions relating to their visits- expenses, visit satisfaction, liked places and so on.

I have chosen this as the best suited form design for my purpose. I need help from KOBO champions for that, what syntax should I add in indexed(${field_name}, ${repeat_group}, position(…)) to display the visited place in the nested repeat group ? I think the form which I attached earlier can help you make understand the scenario; the names of variables are different in this example.

Thanks for your support in advance.
Raj Pravat

Hi @Raj_Pravat
I looked at your logic and I have some suggestions/clarifications that would help us best support you. For starters, I redefined your form essentially because I found one of your logics a bit counterintuitive.

The first step was to create your form as below and test it.

Logically the above form was picking the wrong second repeat that had not been linked to the top repeat in the previous nested repeat iteration. This is definitely a problem. I thereby rethought the logic which would form the basis of how you operationalize this. The following logical steps help you create a referencing you need.

  1. The name i.e. top_repeat will be recalled in the top_repeat_2 (this is straight forward based on position of repeat). However you should limit the number of times this can be recalled by introducing row 13 and cell F14 does the trick for me,
  2. When repeating the top_repeat_2 I want the position to always be referenced for the person at top_repeat, as such I introduced lock of current position at top repeat to be referenced using row 18. I then applied it on D19.

See below snapshot

You can find the excel form here and customize it to your needs. NestedRepeat.xlsx (11.7 KB)

Stephane

1 Like

Hi stephaneaaloo,

Thanks a lot for your sincere look through my survey form and solution support. I tried the form suggested by you; that seems working in Kobocollect app not in Enketo form, while data monitoring in laptop browser before approving field data.
So, please, would you mind looking into this also? So I would also use the form both in Enketo (kobo) and Kobocollect.
Thanks in advance.
Regards,
Raj Pravat