Nested repeat groups with inner repeat having fixed number of repeats

Hi there,

is it possible to use nested repeat groups in ODK? This small test
example crashes when I repeat the outer loop and enter the inner loop
for the second time:

<h:html xmlns="http://www.w3.org/2002/xforms" xmlns:h="http://
www.w3.org/1999/xhtml" xmlns:ev="http://www.w3.org/2001/xml-events"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://
openrosa.org/javarosa">
<h:head>
<h:title>Baseline Test</h:title>





<CONSENT_GIVEN/>
<HOW_MANY/>



<CHILD_NAME/>









</h:head>
<h:body>

Woman

    <group ref="/data/WOMAN/ENROLMENT">
	    <select1 ref="/data/WOMAN/ENROLMENT/CONSENT_GIVEN">
	      <label>"Do you give consent?"</label>
	      <item>
	        <label>Yes</label>
	        <value>1</value>
	      </item>
	      <item>
	        <label>No</label>
	        <value>2</value>
	      </item>
	    </select1>
	    <input ref="/data/WOMAN/ENROLMENT/HOW_MANY">
      		<label>How Many?</label>
    	</input>
    </group>

    <group>
		<label>Child Number </label>
		<repeat nodeset="/data/WOMAN/ChildrenOfMother" jr:count="/data/

WOMAN/ENROLMENT/HOW_MANY">

		<group>
		    <label>Name</label>

			<input ref="/data/WOMAN/ChildrenOfMother/NAMEANDSEX/CHILD_NAME">
		      <label>Name of child</label>
		    </input>
	    </group>
    	</repeat>
    </group>

    </repeat>

If I remove the jr:count attribute then it runs fine. However, I have
a much larger form that I extracted this sub-example from that crashes
even with the jr:count attribute removed.

Best wishes,

Lu

Lu,

To answer your first question: "is it possible to use nested repeat
groups in ODK?" the answer is yes. An example is provided in the
widgets form.

In you specific case you did find the problem " If I remove the
jr:count attribute then it runs fine". The problem is JavaRosa does
not figure out which of the repeat groups it should be pulling the
count from properly. I am not sure how to make JavaRosa pick the right
one, I tried using relative paths but that didn't seem to help. Anyone
used an value in the first repeat to define the length second repeat.
I believe it does work if the value is in the main body and then any
level deep repeat because it's clear what the value is referencing.

Anyone found a work around for this?

Waylon

ยทยทยท On Mon, Jul 2, 2012 at 4:36 AM, Lu wrote: > Hi there, > > is it possible to use nested repeat groups in ODK? This small test > example crashes when I repeat the outer loop and enter the inner loop > for the second time: > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http:// > openrosa.org/javarosa"> > > Baseline Test > > > > > > > > > > > > > > > > > type="select1" required="true()"/> > > > > > > > Woman > > > > > "Do you give consent?" > > Yes > 1 > > > No > 2 > > > > How Many? > > > > > Child Number > > > > Name > > > Name of child > > > > > > > > > > > If I remove the jr:count attribute then it runs fine. However, I have > a much larger form that I extracted this sub-example from that crashes > even with the jr:count attribute removed. > > Best wishes, > > Lu > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en