Creating questions based on selected_multiple and nested repeat_group

1. What is the issue? Please be detailed.
I trying to build a form that collects data using nested group_repeat and select_multiple questions however the form is misbehaving at a critical point.
The scenario is as follows:
I want to capture information on where and how many people have been affected by a specific event. Therefore I have an event group repeat that allows the user to input the number of events that affected the country in a specific year. Inside the event group repeat I want to have the information disaggregated by province and I am using a select_multiple question which allows the respondent to select the provinces that have been affected by the event. By selecting the provinces, the form generates a new group_repeat (inside the event group repeat) that is going to repeat the question to all the selected provinces. Afterward, I want to disaggregate the information for the districts inside the province. To do that I created a new group_repeat that is going to ask the questions based on the districts that belong to the current iteration (position/province). Everything seems to work very well when I select only one province. It allows me to select the districts and populate information for each district that was selected. However, if I select two provinces the form doesn't allow me to select the districts for the provinces I have selected.

2. What steps can we take to reproduce this issue?
If you want to reproduce the issue, run the form, select yes continue/"Sim Continue". Select a Year. input number of events (you can try with 1) in Quantos eventos de desastre afectaram Moçambique em 2001? question. Go down and select one province in Selecione as províncias que foram afectadas pelo evento question. [you should see the district list at the bottom of the form]. Select the districts in Selecione os districtos da província de Inhambane que foram afectados question and you will see how the form should work if it was working fine.
Now, go back to Selecione as provĂ­ncias que foram afectadas pelo evento and select an additional province, you will see that the Selecione os districtos da provĂ­ncia de Maputo que foram afectados question will no longer show the options.

3. What have you tried to fix the issue?
I have tried to play with selected-at function in the choice_filter but with no success. I am stuck and out of ideias.

4. Upload any forms or screenshots you can share publicly below.
Kobo Questionaire - SandBox.xlsx (58.5 KB)

  • Form is here

I am unable to submit screen shots as I am a new user.

I was able to fix the issue.
I added a line that gets the same information that is passed to the groups that identify the provinces.
type|name|calculation
calculate|selected_province|selected-at(${event_affected_admin_1},position(..)-1)

I have then used the information in selected_province to filter out the district of the selected provinces. and it worked.
Kobo Questionaire - SandBox.xlsx (58.4 KB)
See fixed form

1 Like

Glad you figured out a solution!

Please make sure you're very careful to train your data collectors not to change the selection after they have started filling out the related repeat. What you've done with this form design is used the repeat index to look up a value in the select. If the values that are selected change, the values pulled into the repeats will change as well.

2 Likes

Hi, @LN

You are very on point for raising this. I ran into an issue that seems to be similar to what you have called his attention to here, and after testing his solution (using his solution form), I realised that the issue I had in my own case was what his form has developed too.

The issue is illustrated as follows:

Firstly, I selected some of the options in the select multiple that was captured within one of his repeat groups in a single continuous order (e.g., Guija → Mabalane → Mapai), the repeat labels and filtered sub-questions display correctly with no duplication (as seen below)

However, whenever I add another selection to the existing selection, say I chose to add Limpopo , rather for the repeat to adjust and make room for Limpopo, the last option in the previously selected option (this case Mapai) will repeat twice (see below)

What could be the cause for this, and how can this be fixed? Because in my own form, I have a laundry list of options available for respondents to choose from, and they will select no less than 10 out of the available choices.

Secondly, I noticed that the way to correct this (while filling the form, though) is to uncheck the repeated option in the choices (Mapai, in this case) and check it again; then the repeated label will be fixed to the correct order with no repetition (see below).

For this example, Limpopo is now part of the subsequent display. But unfortunately that is not working in my own case. I have to uncheck all the checked options and re-check in a single continouous order.

Kindly guide on how best to avoid this manual debugging through implementing the right fix in the XLSForm.

Thank you.