A problem in nested repeats

Dear All, I am building a survey with lots of repeat groups with other groups.

These groups are structured in the following way

  1. Identify the land plots by name separately for plots that are and are not in wetland/dambo areas

  2. Identify the principal use of the plot

a. If non-wetland plots (called rainfed plots) are destined for crop production(HH2Q6_r=1), then we ask about crop production and sales

b. If wetland plots are destined for crop production or are a kitchen garden (HH2Q6_w=1 or 4), then we ask about crop production and sales.

  1. For each of the plots identified above, ask which crops are being produced in them.

  2. Then ask questions about each crop for each plot

So now the problem. I am going to describe if only using the wetland plots since that’s the section that I’ve developed.

The problem is the following. Imagine I have three wetland plots. The first two are not destined for crop production nor are a kitchen garden (HH2Q6_w!=1 or 4) but the third one is. I get to the listing of the crops for the third plot without any problem since I restricted it to only allow into this group plots that satisfied this condition. But say I select three crops as in this image

image002 (1)

Based on my programming, since I selected 3 crops, I should loop three times for the next set of questions for the third plot.

But loop 1 and 2 are not being linked to Sorghum and Millet respectively. Only the third loop is linked to Groundnuts and then the survey ends, without going over millet and Sorghum (image below). I wrote down a bunch of notes to see what was going on and as you see, the second loop is actually considering the 2nd plot (which I called “2no”) and the first one is considering the first plot although it does not display the name.

I do not understand what is going on since the crop questions should only be asked if “Type plot” ==1 or 4, and you can see that in the first loop the type is 2 and in the second is 3 (based on my example). In line 73 I start a group and it only allows plots type 1 or 4 to go in. So I am completely puzzled as to why the other two plots are inside this group. My guess is that it has to do with something related to the nesting of repeats, but I really do not know how to solve it. Here is the xls form
master (1).xlsx (58.5 KB)

@Kal_Lam any ideas?

@fjiva, I would advise you to share only a short dummy XLSForm that should solve your issue instead of sharing the entire XLSForm. Doing so the community could focus on your issue and help you achieve what you intend to. Could you help the community by sharing only the section of the XLSForm?

1 Like

Here is the shortened version of the xlsform. Hope this helps… Thanks in advance
nested.xlsx (55.4 KB)