Counting the Number of Times Looped

Dear Sirs et Madames,
I am at a point in my survey where a participant is asked how many
children/partners/daughters/etc they have (lets call this Q56 for
question 56), and this figure is stored.. On answering the question,
the survey should go into a loop.

The participant is then asked to give details of each of their
children/partners/daughters/etc e.g name, age, sex,etc. They will do
this for a MAXIMUM of 6 loops (even if the said the had 8 children/
partners/daughters/etc), and a MINIMUM of 1 loop.

After the loop, the survey then asks (a question) if :

  • The number of columns (loops) agree with the response to Q56?
  • The number of columns (loops) > Q56
  • The number of columns < Q56
  • The number of columns < Q56 because respondent has more than 6
    children/partners/daughters/etc (and we set our max number of loops to

How can this be achieved?

Thanks in advance,
Tumaini

Is there an inbuilt "function" one can call to find out how many times
a loop has ran? If so I could use this with some XPath arithmetic to
work out the difference (if any) between the respondents response to
Q56 and the actual number of loops that run, thus noting any
discrepancies that way I guess...

··· On Nov 26, 3:26 pm, Tumaini Kilimba wrote: > Dear Sirs et Madames, > I am at a point in my survey where a participant is asked how many > children/partners/daughters/etc they have (lets call this Q56 for > question 56), and this figure is stored.. On answering the question, > the survey should go into a loop. > > The participant is then asked to give details of each of their > children/partners/daughters/etc e.g name, age, sex,etc. They will do > this for a MAXIMUM of 6 loops (even if the said the had 8 children/ > partners/daughters/etc), and a MINIMUM of 1 loop. > > After the loop, the survey then asks (a question) if : > > * The number of columns (loops) agree with the response to Q56? > * The number of columns (loops) > Q56 > * The number of columns < Q56 > * The number of columns < Q56 because respondent has more than 6 > children/partners/daughters/etc (and we set our max number of loops to > 6) > > How can this be achieved? > > Thanks in advance, > Tumaini

there is currently no easy way to find out how many times a loop has run.

the javarosa-core has a new implementation of repeats that we will try
to add to collect 1.1.8. i'm not entirely sure it'll work, but it's
your best bet if you need this feature today.

see https://groups.google.com/d/topic/javarosa-developers/bESRdyBFlA8/discussion
for more.

··· On Sat, Nov 26, 2011 at 18:01, Tumaini Kilimba wrote: > Is there an inbuilt "function" one can call to find out how many times > a loop has ran? If so I could use this with some XPath arithmetic to > work out the difference (if any) between the respondents response to > Q56 and the actual number of loops that run, thus noting any > discrepancies that way I guess... > > > > On Nov 26, 3:26 pm, Tumaini Kilimba wrote: >> Dear Sirs et Madames, >> I am at a point in my survey where a participant is asked how many >> children/partners/daughters/etc they have (lets call this Q56 for >> question 56), and this figure is stored.. On answering the question, >> the survey should go into a loop. >> >> The participant is then asked to give details of each of their >> children/partners/daughters/etc e.g name, age, sex,etc. They will do >> this for a MAXIMUM of 6 loops (even if the said the had 8 children/ >> partners/daughters/etc), and a MINIMUM of 1 loop. >> >> After the loop, the survey then asks (a question) if : >> >> * The number of columns (loops) agree with the response to Q56? >> * The number of columns (loops) > Q56 >> * The number of columns < Q56 >> * The number of columns < Q56 because respondent has more than 6 >> children/partners/daughters/etc (and we set our max number of loops to >> 6) >> >> How can this be achieved? >> >> Thanks in advance, >> Tumaini > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en

Hello Yaw,
I have attached a screen shot of of the Household Survey (one of the sample
forms provided) at the point that it is withing a loop. You can see on the
top left hand corner it shows in brackets the loop number, right next to
the group label, ie. "Household Members>Child in Household (1)", the 1 in
brackets denoting the number of times looped so far. It seems to me if ODK
is storing this information and can access this information, is there no
way of programatically accessing it?

Thanks in advance,
Tumaini

··· On Wed, Nov 30, 2011 at 6:42 AM, Yaw Anokwa wrote:

there is currently no easy way to find out how many times a loop has run.

the javarosa-core has a new implementation of repeats that we will try
to add to collect 1.1.8. i'm not entirely sure it'll work, but it's
your best bet if you need this feature today.

see
https://groups.google.com/d/topic/javarosa-developers/bESRdyBFlA8/discussion
for more.

On Sat, Nov 26, 2011 at 18:01, Tumaini Kilimba tkilimba@ihi.or.tz wrote:

Is there an inbuilt "function" one can call to find out how many times
a loop has ran? If so I could use this with some XPath arithmetic to
work out the difference (if any) between the respondents response to
Q56 and the actual number of loops that run, thus noting any
discrepancies that way I guess...

On Nov 26, 3:26 pm, Tumaini Kilimba tkili...@ihi.or.tz wrote:

Dear Sirs et Madames,
I am at a point in my survey where a participant is asked how many
children/partners/daughters/etc they have (lets call this Q56 for
question 56), and this figure is stored.. On answering the question,
the survey should go into a loop.

The participant is then asked to give details of each of their
children/partners/daughters/etc e.g name, age, sex,etc. They will do
this for a MAXIMUM of 6 loops (even if the said the had 8 children/
partners/daughters/etc), and a MINIMUM of 1 loop.

After the loop, the survey then asks (a question) if :

  • The number of columns (loops) agree with the response to Q56?
  • The number of columns (loops) > Q56
  • The number of columns < Q56
  • The number of columns < Q56 because respondent has more than 6
    children/partners/daughters/etc (and we set our max number of loops to

How can this be achieved?

Thanks in advance,
Tumaini

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

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

while you are in a repeat prompt, the java code (and not the xform
side of things) has access to repeat count (aka multiplicity).

http://code.google.com/p/opendatakit/source/browse/src/org/odk/collect/android/views/ODKView.java?repo=collect#132

once you leave that prompt, you do not have easy access to that
information. you can hard code some java that gets to that
information, but that's will be bad hack.

··· On Wed, Nov 30, 2011 at 02:25, Tumaini Kilimba wrote: > Hello Yaw, > I have attached a screen shot of of the Household Survey (one of the sample > forms provided) at the point that it is withing a loop. You can see on the > top left hand corner it shows in brackets the loop number, right next to the > group label, ie. "Household Members>Child in Household (1)", the 1 in > brackets denoting the number of times looped so far. It seems to me if ODK > is storing this information and can access this information, is there no way > of programatically accessing it? > > Thanks in advance, > Tumaini > > > On Wed, Nov 30, 2011 at 6:42 AM, Yaw Anokwa wrote: >> >> there is currently no easy way to find out how many times a loop has run. >> >> the javarosa-core has a new implementation of repeats that we will try >> to add to collect 1.1.8. i'm not entirely sure it'll work, but it's >> your best bet if you need this feature today. >> >> see >> https://groups.google.com/d/topic/javarosa-developers/bESRdyBFlA8/discussion >> for more. >> >> On Sat, Nov 26, 2011 at 18:01, Tumaini Kilimba wrote: >> > Is there an inbuilt "function" one can call to find out how many times >> > a loop has ran? If so I could use this with some XPath arithmetic to >> > work out the difference (if any) between the respondents response to >> > Q56 and the actual number of loops that run, thus noting any >> > discrepancies that way I guess... >> > >> > >> > >> > On Nov 26, 3:26 pm, Tumaini Kilimba wrote: >> >> Dear Sirs et Madames, >> >> I am at a point in my survey where a participant is asked how many >> >> children/partners/daughters/etc they have (lets call this Q56 for >> >> question 56), and this figure is stored.. On answering the question, >> >> the survey should go into a loop. >> >> >> >> The participant is then asked to give details of each of their >> >> children/partners/daughters/etc e.g name, age, sex,etc. They will do >> >> this for a MAXIMUM of 6 loops (even if the said the had 8 children/ >> >> partners/daughters/etc), and a MINIMUM of 1 loop. >> >> >> >> After the loop, the survey then asks (a question) if : >> >> >> >> * The number of columns (loops) agree with the response to Q56? >> >> * The number of columns (loops) > Q56 >> >> * The number of columns < Q56 >> >> * The number of columns < Q56 because respondent has more than 6 >> >> children/partners/daughters/etc (and we set our max number of loops to >> >> 6) >> >> >> >> How can this be achieved? >> >> >> >> Thanks in advance, >> >> Tumaini >> > >> > -- >> > Post: opendatakit@googlegroups.com >> > Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> > Options: http://groups.google.com/group/opendatakit?hl=en >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en > >