Add Repeated Groups Based on selected options of Multi-select question

We want to create a repeated groups based on selections in one of the multi-select questions. Is it possible to determine number of repeated groups based on number of selections and then auto-fill the first response in each repeated group with one of the selections and continue the repeat groups for each selection.

For example:
The selections in multi-select question are as follow:

Q:Electronic Items You have:
1-Laptop (Selected)
2-iPhone (Not Selected)
3-iPad (Selected)
4-TV (Selected)

I want the repeated group to repeat 3 times based on 3 selections. And then in each repeated group, it prefill the response to the first question as the value of first item selected above:

[Repeated Group 1]
Q1.Item Type: (Laptop)

[Repeated Group 2]
Q1.Item Type: (iPad)

[Repeated Group 3]
Q1.Item Type: (TV)

Welcome @samim,
This requires advanced form development. You can use

  • count-selected( …) to set repeat_count
  • position( ) in the loop to get selected_at(…) from your select_multiple question
  • set this selected item (label? or name?) in the variable or its label in the loop, with a calculation or a ${…} reference
  • if you use an overall group inside the loop, you could even set a dynamic text reference in the group label.

Be careful, references in labels will not be stored/submitted.

1 Like

Thank you Dear @wroos for the guidance and quick response
I am still new Kobo user and am learning advance features. Is there any other form that might have implemented similar questionnaire that I could follow? I still don’t know how to add loop.
Attached is the sample Excel file I have worked so far, appreciate if you could have a look
dynamic repeat groups.xlsx (14.0 KB)

@samim, maybe you could have a look at this post discussed previously (it should help you solve your issue):

Dear @Kal_Lam
The example you shared is exactly what I needed. I brought the [jr:choice-name(selected-at(${…] calculation inside the repeated group, and it worked.
Sharing the updated XLS of my form here as well.
dynamic repeat groups (corrected).xlsx (13.9 KB)
Thank you both @Kal_Lam and @wroos for the guidance. Very much appreciated.

1 Like

@samim, thank you for sharing the same with the community! It should be helpful for those needing the same.

Could you please support on this, I am using the same design and I found the issue that is related to user interaction with the form.

Here is an example:

  • if you select to fill the form for Laptop, then proceed to fill the repeat group for laptop. (All ok until now).
  • If you changed your response and remove the selection for Laptop and selected iPad as an example, the data that was filled for Laptop in the group repeat will not be deleted, and it will be for the iPad.

Any ideas to fix this?

Hi @Kal_Lam , @wroos, @samim

Anyone can help me to solve the auto fill in repeat group based on multiple selected. I tried many time but it not working.
Testing auto select multiple.xlsx (11.2 KB)