Repeat with multiple selection

Dear all,

Can anyone send me an example (xls) with a repeat with multiple selection.
I want to create a form with a list of multiple herbicides and do some
repeating questions for each herbicide that is selected. There was some
discussion topic on this, but I can't get this thing work in my excel. Most
of the discussion there is on the Xform-level, for which I don't have
enough experience... Would be good to have an example form... Many thanks
in advance!

Kind regards,

Ed

Dear all,

I solved it. I included the excel file for others that might want to
include this functionally in their forms.

Kind regards,

Ed

Test_looping_with_select_multiple_v9.xls (62 KB)

ยทยทยท On Monday, April 14, 2014 1:41:10 PM UTC+2, Eddy Rellum wrote: > > Dear all, > > Can anyone send me an example (xls) with a repeat with multiple selection. > I want to create a form with a list of multiple herbicides and do some > repeating questions for each herbicide that is selected. There was some > discussion topic on this, but I can't get this thing work in my excel. Most > of the discussion there is on the Xform-level, for which I don't have > enough experience... Would be good to have an example form... Many thanks > in advance! > > Kind regards, > > Ed >
1 Like

Hi Eddy,

A word of caution: When using repeat groups in your forms, be sure to test
the form by filling out 2 or more instances of each repeat group within the
same filled-in form
.

XLSForm expands ${q1} to the full absolute reference to the field, e.g.,
/myform/repeat1/q1

When you add the second copy of the repeat group, this will expand to refer
to a list of two values -- the first repeat's value and the second repeat's
value.

And this often crashes the form's constraint, relevant or calculate
expressions.

The fix is to replace ${q1} in those broken expressions with relative
references to these values, e.g., in a constraint for /myform/repeat1/q2,
rather than refer to ${q1}, the constraint should refer to ../q1 -- the
value of q1 within this same copy of the repeat group.

These are tricky to discover and correct.

ยทยทยท ----------- Mitch

On Mon, Apr 14, 2014 at 6:49 AM, Eddy Rellum 4estsense@gmail.com wrote:

Dear all,

I solved it. I included the excel file for others that might want to
include this functionally in their forms.

Kind regards,

Ed

On Monday, April 14, 2014 1:41:10 PM UTC+2, Eddy Rellum wrote:

Dear all,

Can anyone send me an example (xls) with a repeat with multiple
selection. I want to create a form with a list of multiple herbicides and
do some repeating questions for each herbicide that is selected. There was
some discussion topic on this, but I can't get this thing work in my excel.
Most of the discussion there is on the Xform-level, for which I don't have
enough experience... Would be good to have an example form... Many thanks
in advance!

Kind regards,

Ed

--

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.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Hi Mitch,

Could you give me an example your solution (see below), by for example
using the form that I uploaded for this post? I do not understand it
entirely. Would be great, but if you don't have time for this, I will
understand. Thanks in advance.

Kind regards,

Eddy

ยทยทยท On Monday, April 14, 2014 10:26:31 PM UTC+2, Mitch Sundt wrote: > > Hi Eddy, > > A word of caution: When using repeat groups in your forms, *be sure to > test the form by filling out 2 or more instances of each repeat group > within the same filled-in form*. > > XLSForm expands ${q1} to the full absolute reference to the field, e.g., > /myform/repeat1/q1 > > When you add the second copy of the repeat group, this will expand to > refer to a list of two values -- the first repeat's value and the second > repeat's value. > > And this often crashes the form's constraint, relevant or calculate > expressions. > > The fix is to replace ${q1} in those broken expressions with relative > references to these values, e.g., in a constraint for /myform/repeat1/q2, > rather than refer to ${q1}, the constraint should refer to ../q1 -- the > value of q1 within this same copy of the repeat group. > > These are tricky to discover and correct. > ----------- > Mitch > > > > On Mon, Apr 14, 2014 at 6:49 AM, Eddy Rellum <4est...@gmail.com > wrote: > >> Dear all, >> >> I solved it. I included the excel file for others that might want to >> include this functionally in their forms. >> >> Kind regards, >> >> Ed >> >> On Monday, April 14, 2014 1:41:10 PM UTC+2, Eddy Rellum wrote: >> >>> Dear all, >>> >>> Can anyone send me an example (xls) with a repeat with multiple >>> selection. I want to create a form with a list of multiple herbicides and >>> do some repeating questions for each herbicide that is selected. There was >>> some discussion topic on this, but I can't get this thing work in my excel. >>> Most of the discussion there is on the Xform-level, for which I don't have >>> enough experience... Would be good to have an example form... Many thanks >>> in advance! >>> >>> Kind regards, >>> >>> Ed >>> >> -- >> -- >> Post: opend...@googlegroups.com >> Unsubscribe: opendatakit...@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...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

I don't have time.

Generate the XML from your XLS.

Then view the XML in a text editor (e.g., Notepad++).

The XML structure is described here:

The repeat group of your form will contain within it the fields for the
questions you are referencing. E.g.,

  <instance>
    <data id="exampleForm">
      <household_id/>
      <members>
        <name/>
        <age/>
        <education/>
      </members>
    </data>
 </instance>

If your form referenced ${age} it would be expanded to /data/members/age in
the XML. Look at these expansions in your form.

The problem is that /data/members is a repeat group. If you need to
reference the age of the member being interviewed in order to prompt for
the value of the education field, you need to use a relative path to
reference that age; ${age} ( /data/members/age in the XML ) will return a
set of all ages, which is not what you want.

If you are on the 'education' question for the 2nd member of the household,
these are equivalent expressions:

../age == /data/members[2]/age
../age == /data/members[position(..)]/age
../name == /data/members[2]/name
../name == /data/members[position(..)]/name

If the 1st member had an age of 14 and the 2nd member had an age of 6, then

/data/members/age (i.e., ${age} ) will refer to the set of values { 14, 6
} and there are not many functions in ODK Collect that can manipulate sets.

ยทยทยท On Mon, Jun 9, 2014 at 4:46 AM, Eddy Rellum <4estsense@gmail.com> wrote:

Hi Mitch,

Could you give me an example your solution (see below), by for example
using the form that I uploaded for this post? I do not understand it
entirely. Would be great, but if you don't have time for this, I will
understand. Thanks in advance.

Kind regards,

Eddy

On Monday, April 14, 2014 10:26:31 PM UTC+2, Mitch Sundt wrote:

Hi Eddy,

A word of caution: When using repeat groups in your forms, be sure to
test the form by filling out 2 or more instances of each repeat group
within the same filled-in form
.

XLSForm expands ${q1} to the full absolute reference to the field, e.g.,
/myform/repeat1/q1

When you add the second copy of the repeat group, this will expand to
refer to a list of two values -- the first repeat's value and the second
repeat's value.

And this often crashes the form's constraint, relevant or calculate
expressions.

The fix is to replace ${q1} in those broken expressions with relative
references to these values, e.g., in a constraint for /myform/repeat1/q2,
rather than refer to ${q1}, the constraint should refer to ../q1 -- the
value of q1 within this same copy of the repeat group.

These are tricky to discover and correct.

Mitch

On Mon, Apr 14, 2014 at 6:49 AM, Eddy Rellum 4est...@gmail.com wrote:

Dear all,

I solved it. I included the excel file for others that might want to
include this functionally in their forms.

Kind regards,

Ed

On Monday, April 14, 2014 1:41:10 PM UTC+2, Eddy Rellum wrote:

Dear all,

Can anyone send me an example (xls) with a repeat with multiple
selection. I want to create a form with a list of multiple herbicides and
do some repeating questions for each herbicide that is selected. There was
some discussion topic on this, but I can't get this thing work in my excel.
Most of the discussion there is on the Xform-level, for which I don't have
enough experience... Would be good to have an example form... Many thanks
in advance!

Kind regards,

Ed

--

Post: opend...@googlegroups.com
Unsubscribe: opendatakit...@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...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitche...@gmail.com

--

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.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com