How use index-repeat()

Hi Daniel,

You can find information on how to use indexed-repeat() at
https://opendatakit.org/help/form-design/binding/ and
http://xlsform.org/ref-table/.

https://groups.google.com/forum/#!searchin/opendatakit/indexed-repeat|sort:relevance
also has lots of threads discussing it.

My recommendation is to start with the smallest form (e.g., 1-2
questions inside a repeat) and try to use indexed-repeat() so you
understand the behavior. Once you have that working, try to apply it
to your form.

Thanks,

Yaw

··· On Fri, May 12, 2017 at 11:27 AM, Daniel Couret wrote: > Hi, > > I try to know how works index-repet () > > In a loop appeal in values in cascades and choix_list or in choice_filter, I > obtain an error message asking me to use index-repet (). > > I do not have to find of clear documentation on this subject. > > Could you help me? > > Thanks > > Daniel > > -- > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "ODK Community" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to opendatakit+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
2 Likes

A big thank Yam,

I have already browsed (again and again) these documents since I began ODK,
but it is clearly necessary to say that it is not accessible to everybody!

··· ------------- XlsForm Reference Table : indexed-repeat() : Returns a single node from a nodeset by selecting the 1-based index of a repeat nodeset. It does this up to 3 repeat levels deep. indexed-repeat(nodeset arg, nodeset repeat1, int index1, [nodeset repeatN, int indexN]{0,2}) nodeset arg ? nodeset repeat1 ? int index1 ? [nodeset repeatN ? int indexN]{0,2} ? ---------------- Binding (opendatakit.org) :

It make a reference to Xpath? In node and nodeset?
It is going to need that I learn all the XML language to use ODK with a
minimum of efficiency?

I would like to stay on forms Excel and not to practice for the moment on
the .xml, even if I should make it later.

Cannot one "standardize" the language of explanation or at least make it
understandable for all?
If not a small basic dictionary would be very useful.

For the msg on ODKcommunauty
I have to look at all the messages on index-repeat() with problem and I did
not still understand how it worked especially when
the proposed corrections do not work!

We are several to ask ourselves the question and to apply without
understanding does not make party of my way make.

Cannot one have a tuto from 10 to 20 lines which would explain the
principle and implemented?

I do not ask for it specially Yam, who gives us already so much, but other
members who use this function can bring us a help.

Cordially

Dan

Hi Daniel:

Perhaps it would help us answer your questions if you provided a little
more detail on what you're trying to achieve, and maybe a sample of your
form if you can share it?

There are many things one can do with indexed-repeat, so it's difficult to
explain very quickly how to use it.

Best,
Clint

··· On Mon, May 15, 2017 at 9:09 AM, Daniel Couret wrote:

A big thank Yam,

I have already browsed (again and again) these documents since I began ODK,
but it is clearly necessary to say that it is not accessible to everybody!

XlsForm Reference Table :
indexed-repeat() : Returns a single node from a nodeset by selecting the
1-based index of a repeat nodeset. It does this up to 3 repeat levels deep.
indexed-repeat(nodeset arg, nodeset repeat1, int
index1, [nodeset repeatN, int indexN]{0,2})
nodeset arg ?
nodeset repeat1 ?
int index1 ?
[nodeset repeatN ?
int indexN]{0,2} ?

Binding (opendatakit.org) :

It make a reference to Xpath? In node and nodeset?
It is going to need that I learn all the XML language to use ODK with a
minimum of efficiency?

I would like to stay on forms Excel and not to practice for the moment on
the .xml, even if I should make it later.

Cannot one "standardize" the language of explanation or at least make it
understandable for all?
If not a small basic dictionary would be very useful.

For the msg on ODKcommunauty
I have to look at all the messages on index-repeat() with problem and I
did not still understand how it worked especially when
the proposed corrections do not work!

We are several to ask ourselves the question and to apply without
understanding does not make party of my way make.

Cannot one have a tuto from 10 to 20 lines which would explain the
principle and implemented?

I do not ask for it specially Yam, who gives us already so much, but other
members who use this function can bring us a help.

Cordially

Dan

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thnks Clint,

i am obliged to delve into the xml format, this will take me a little bit
of time.
If I still have problems I would come back to you.
Cordially
Dan

··· Le mardi 16 mai 2017 21:47:49 UTC, Clint Tseng a écrit : > > Hi Daniel: > > Perhaps it would help us answer your questions if you provided a little > more detail on what you're trying to achieve, and maybe a sample of your > form if you can share it? > > There are many things one can do with indexed-repeat, so it's difficult to > explain very quickly how to use it. > > Best, > Clint > >

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

impact_survey_household_questionnaire_2019.xlsx (30.2 KB) .

Thanks in advance

1 Like

Hi @Musinguzi_Polycarp

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).

I hope this helps!

Best,
Andrea

1 Like

Thanks @Andrea_Martin for the tips. Option one is the most relevant in my case, but please advise on how the calculation would look like. Thanks

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

Hi @Musinguzi_Polycarp

Please find attached (impact_survey_household_questionnaire_2019_AM.xlsx (28.2 KB) ) an edited version of your form, that should address your problem.
The edits include:

  • adding a calculated field (${below5})
  • editing the relevant field to count how many children below (or equal to) 5yo are present in the household.

I hope this helps!

Best,
Andrea

2 Likes

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

Hi @Musinguzi_Polycarp

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

Best,
Andrea

1 Like

Thanks, @Andrea_Martin worked fine.

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)

Hi @Naveen_Agarwal

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).

  1. What is the problem? Please be detailed.
  2. What ODK tool and version are you using? And on what device and operating system version?
  3. What steps can we take to reproduce the problem?
  4. What you have you tried to fix the problem?
  5. Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Best,
Andrea

Hi everyone
have this problem and I can't figure out the solution please can you help me?
20201210_Chemonics - Manahel Parents (Caregiver) Questionnaire.xls (213 KB)

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

if you don't understand how to fix your problem please read Referencing repeated questions from outside the repeat it should help.

1 Like

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 @Charles_Marc
Please attach your form (or a short version of it if it's big) so that we can take a look at it and help you.

A post was split to a new topic: Error evaluating

kobo _support.xlsx (41.7 KB)


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.