Dear ODK Users,
I am facing a related situation.
I have a repeat group (details of household members) where one of the questions is age. As the form progresses, I have another group where I intend to capture information on the prevalence of WATSAN Among Under-five Children. Now I would like this second group only to show up only if in the household there is or are any children aged five years and below. Problem is, while the form seems to evaluate well in XLSForm Online, in ODK it gives an error (see attached). How can I solve this problem? I have read about Repeat Recipes and Tips, but still can't figure out what I need to do.
I have also attached a sample of the form for you to check out
the error is in cell E24 of your excel file.
You are trying to refer a repeated variable ${Q201d}, and the application does not know which iteration you want to use. At the end of the error message you have a hint, which is to use the indexed-repeat() function.
In your particular case I'd suggest two possible approaches:
a) if the second group of questions "children-under-five" refer to the expenses of the whole household, you might want to create a calculated field after the repeated group to count the number of household members below 5. The relevant condition for your group "children-under-five" would then become that this variable is greater than zero;
b) if the second group contains questions that might be relevant to each of the children, you might want to take questions Q500a-Q502 and move them into the repeated group. In this case, you could use your existing relevant condition for each of the questions (because they will be inside the loop).
Any help how to get this calculation done? I have used count(${Q201d})<5, but it doesn't sem to give me the number of children in the family below the age of 5. Kindly assist
Many thanks, @Andrea_Martin. One last thing, having asked the age of each household member in that repeat group, how then can calculate the number of children aged 5 and below as well as those above 5. Using if(${Q201d}<=5,1,0) only shows me that there are children aged 5 and below, but doesn't tell me how many. Similarly, count(${Q201d})<5 wasn't helping either
To calculate the number of children below 5 you can do as per file I attached before.
There are different approaches, but the one I'm suggesting is:
You include in the repeat group a calculate variable "tagging" the observations you are interested in, for example the var ${below5} takes the value 1 if the age is <=5;
You create a calculate variable outside the repeat group summing up the values (counts) of the variables you have tagged - e.g. sum(${below5})
You can adapt this approach to other age brackets or variables.
Note that:
in the file I sent you
I skipped the creation of a new calculated variable and just included the formula in the relevant field
Hi, @Andrea_Martin
I am facing the same issue but not able to trace why this issue is coming. In my case, I am not referring to intergroup and not needed any value from other groups. Please attached the Excel form. The group "Survey" is absolutely working fine, however, as soon as I start group "relative" at row number 265 it suggests use the index-repeat function. Kindly help. ASPIRE_v20.1.xlsx (90.6 KB)
I am not sure I understand which issue you are experiencing.
I tried to convert the your form with https://opendatakit.org/xlsform/ and it doesn't throw any errors. Kindly provide more details to better assist you (see below).
What is the problem? Please be detailed.
What ODK tool and version are you using? And on what device and operating system version?
What steps can we take to reproduce the problem?
What you have you tried to fix the problem?
Anything else we should know or have? If you have a test form or screenshots or logs, attach here.
Hi @mmusto
it looks like you are trying to refer to questions that are inside repeats being outside of such a group. Then you need to use indexed-repeat function to define which repeat you want to refer.
Your form is not small and you need to review it carefully on your own but you made that mistake at least in two places:
row 59 in relevant you have ${N_Pa_1_3_boys_son_go_school} ='1001' but ${N_Pa_1_3_boys_son_go_school} is a repeatable question so you need to specify the number of repetition you want to refer.
row 71 in relevant you have ${N_Pa_1_3_girls_daughter_go_school} ='1111' and the same mistake as above
Hi Grzesiek2010....i have a problem with my indexed repeat: i am trying to ask follow-up question from previous repeat about children between the ages of 6 months to 24 months but i don't how to implement this...can you help me?
Hi Grzesiek,
I a having an error on my form and I dont know the source. I have attached a screen shot of the error and the xlsform.
Kindly assist me in finding my way around.