Referencing Iterations in Repeat Groups

Hi all.

I hope somebody can advise me on my problem. I have searched here but cant find a solution. So what I am trying to do is ask HH size and then for each member of the HH we will ask a set of questions.

In these set of questions I would like to reference the repeat count. So instead of asking for the age of the household member, I would like to ask the age of HH member number 1 for the first iteration, age of HH member number 2 in the second iteration and so on.

Is this possible?

Thank you

Hi @martin_kenny and welcome to the community!

I think what you are looking is called indexed-repeat, Kal made a great post about it:

Alternatively you can check the GetODK’s form operators:

1 Like

Thank you for the response but it wont quite work for me. I am not asking names of poople. Just asking for household size and then for each iteration of the repeat group I want it to ask for instance Age of HH Number ${iteration group}.

@martin_kenny, did you mean, like, suppose you provided name in the first iteration? So if you would like to put the name to the question, what is the age of ...? Is this what you are looking for?

Hi sorry for not being clear, it is often a problem of mine to clearly express what is in my head :slight_smile:

So basically here is it in more detail.

begin group

Question 1, how many members asre you in your household?
Answer: 3

Begin repeat group iteration 1

Repeat Q1 What is the gender of HH member ${iteration of group}?
Repeat Q2 What is the age ${iteration of group}?

End iteration 1

begin iteration 2

Repeat Q1 What is the gender ${iteration of group}?
Repeat Q2 What is the age ${iteration of group}?
End iteration 2

end repeat group

end group

Hi @martin_kenny , did you find a solution for this?