Referencing repeat the iteration number within a question in a repeat group

Hi everyone. I’m doing a survey on public toilets in an area, and the survey is organized to go cubicle by cubicle. For example:

  1. How many cubicles are there within this P.T? (3)
    Repeat group begins
    Repeat 1:
    1(a) Cubicle (1) is clean
    1(b) Cubicle (1) is well-lit
    Repeat 2:
    1(a) Cubicle (2) is clean
    1(b) Cubicle (2) is well-lit
    Repeat 3:
    1(a) Cubicle (3) is clean
    1(b) Cubicle (3) is well-lit

So far, I cannot seem to figure out how to embed the repeat iteration count in the question. I referenced Q1, but that only gives me the total number of iterations, and the output turns out like this:

  1. How many cubicles are there within this P.T? (3)
    Repeat group begins
    Repeat 1:
    1(a) Cubicle (3) is clean
    1(b) Cubicle (3) is well-lit
    Repeat 2:
    1(a) Cubicle (3) is clean
    1(b) Cubicle (3) is well-lit
    Repeat 3:
    1(a) Cubicle (3) is clean
    1(b) Cubicle (3) is well-lit

Referencing the iteration is important for me, because in some Public Toilets, there are nearly 10 cubicles, and when surveyors fill the form out on KoboTool, they may sometimes lose track of which cubicle details they are filling in (esp. if they are interrupted, etc).

There was a similar question here (Referencing Iterations in Repeat Groups), but there was no solution there either.

Could someone please help?

You can use position( 2 dots ), see ODK XForms Specification.
And with the search function of this forum, you can find more hints, e.g. Is there a way to capture the current index of the repeating group?.

So, you use a calculate type variable with calcultion position( 2 dots ). Then you can $-reference this variable, for ex. in the label of a group, a question or a note.

1 Like

@dhd, this post discussed previously should also be helpful for you to understand how to use the position() function.