I have a problem with the (indexed repeat). I don't understand exactly how to use indexed repeat, I searched in web and tried a lot, but I still have a problem.
I have 3 (select_one) nested questions (that connect with each other by choice filter), and I want to repeat them. the operation interrupt in the second repeat
I attached the exel file, Can you please help me to know how to solve it.
regions.xlsx (11.5 KB)
Please describe wat you are trying to achieve? I do not see a set of questions that you want to repeat?
I want to repeat a group of select_one questions that are (governorate - district and sub-district) and these questions are related together by choice-filter.
the number of repetitions is determine in line(3) [in the exel file I had attached].
The user will determine the number of repetition in line 3, then he will chose (the governorate, district and sub district) in the first repetition, then this process will repeat based on the number in line 3.
Sorry to prolongation
Choice filter does not work in repeat. This is simply because choice filter has attribute which is there in both the repeats .So it faces ambiguity regarding which to choose . I tried this but was unable to do. The way I have done this is to have different questions with relevant conditions on it . But my choices were less in number so that was possible. In your case choices are more so better go for external .csv where you can pull the data from .csv based on your choice. For better understanding please look at this link . If you find any way using choice filter please let me know
Thanks and Regards,
If the 3 geographic levels are related, I would recommend placing them together in a single repeat, and looping through that single repeat three times. So you you enter in this order
Secondly, you can do a choice-filter within repeats, but you want to use a relative reference to refer to the value, and in my experience you need to use a current() reference as well. You can read more about it here:
https://opendatakit.org/help/form-design/#xpath_expressions (search for "current()")
Although in my experience (using an older version of ODK, don't know if it is still this way), you have to shift the reference by one level when using it in a choice filter (so a reference to a question in the same repeat and same group would be current()/questionname rather than current()/../questionname).
If you aren't comfortable with these concepts you may want to consider modifying your design to work with your experience level. One option would be 3 independent non-repeating sets of questions, each of which shows if gov_no >= 1/2/3
if gov_no >= 1
if gov_no >= 2