Sub-select questions

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure of a
better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10 possible
options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I don't
want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the district),
followed by 10 questions for subdistrict (and controlling which of
these appeared by using the relevant attribute on the bind node), but
trying to save the response from any of the 10 subdistrict questions
in the same /data/subdistrict. Like this:




...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I also
tried adding the relevant attribute to the item node, e.g:



...

Sub District
SubDistrict A</
label>SD_A
SubDistrict B</
label>SD_B
SubDistrict C</
label>SD_C
SubDistrict D</
label>SD_D

but seems this isn't valid syntax (or rather the relevant attribute is
ignored).

For info I saw the messages
https://groups.google.com/group/opendatakit/browse_thread/thread/e5d03925a86dd8ed/34b77d2d16a170fd?hl=en&lnk=gst&q=dynamic+select#34b77d2d16a170fd
and
https://groups.google.com/group/opendatakit/browse_thread/thread/ba6204204ddd17ed/db794f8aba99f07d?hl=en&lnk=gst&q=dynamic+select#db794f8aba99f07d
and think my query is similar. These message are from over a year ago,
so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice much
appreciated.

Cheers,
Alex

Alex,

Each district has to have its own subdistrict prompt.

SubDistrict1 ASD1_A SubDistrict1 BSD1_B

Yaw

··· On Wed, May 9, 2012 at 4:01 AM, Alex Little wrote: > Hi all, > > I'm trying to figure out how to have multiple questions store the > question response in the same instance/nodeset. Not quite sure of a > better way to explain this, so probably best illustrated with an > example: > > Suppose I have one question (/data/district) which has 10 possible > options, in the next question I want to select which of the 5 > subdistricts (/data/subdistrict), but I only want to display the > subdistricts relevant for the selected district (not all 50). I don't > want to end up with the database having 10 different subdistrict > columns (only one of which will ever be completed). > > My first attempt was to have 1 initial question (for the district), > followed by 10 questions for subdistrict (and controlling which of > these appeared by using the relevant attribute on the bind node), but > trying to save the response from any of the 10 subdistrict questions > in the same /data/subdistrict. Like this: > > type="select1"/> > relevant="selected(/data/district,'1')"/> > relevant="selected(/data/district,'2')"/> > ... > and > > District > District 11 > District 22 > > > Sub District > SubDistrict ASD_A > SubDistrict BSD_B > > > Sub District > SubDistrict CSD_C > SubDistrict DSD_D > > > However, it always shows all of the subdistrict questions. So I also > tried adding the relevant attribute to the item node, e.g: > > type="select1"/> > > ... > > Sub District > SubDistrict A label>SD_A > SubDistrict B label>SD_B > SubDistrict C label>SD_C > SubDistrict D label>SD_D > > > but seems this isn't valid syntax (or rather the relevant attribute is > ignored). > > For info I saw the messages > https://groups.google.com/group/opendatakit/browse_thread/thread/e5d03925a86dd8ed/34b77d2d16a170fd?hl=en&lnk=gst&q=dynamic+select#34b77d2d16a170fd > and > https://groups.google.com/group/opendatakit/browse_thread/thread/ba6204204ddd17ed/db794f8aba99f07d?hl=en&lnk=gst&q=dynamic+select#db794f8aba99f07d > and think my query is similar. These message are from over a year ago, > so wondered if there were any updates? > > Perhaps I'm approaching this the wrong way? So any help/advice much > appreciated. > > Cheers, > Alex

You can need itemsets for your cascading selection. You can use
KoBoCollect, which is based on ODK Collect, but also has support for
itemsets.
You can put your Districts and Subdistricts in a CSV and import them into
KoBoForm, that will help you build your form.
You can run your form in the KoBoCollect Android app.

There are very detailed instructions here:
http://www.kobotoolbox.org/support/userguide/koboform/cascadingselect

Let us know how it goes,

☞§※☼:airplane::open_umbrella::slight_smile:
~Neil

··· On Wed, May 9, 2012 at 7:01 AM, Alex Little wrote:

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure of a
better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10 possible
options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I don't
want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the district),
followed by 10 questions for subdistrict (and controlling which of
these appeared by using the relevant attribute on the bind node), but
trying to save the response from any of the 10 subdistrict questions
in the same /data/subdistrict. Like this:




...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I also
tried adding the relevant attribute to the item node, e.g:



...

Sub District
SubDistrict A</
label>SD_A
SubDistrict B</
label>SD_B
SubDistrict C</
label>SD_C
SubDistrict D</
label>SD_D

but seems this isn't valid syntax (or rather the relevant attribute is
ignored).

For info I saw the messages

https://groups.google.com/group/opendatakit/browse_thread/thread/e5d03925a86dd8ed/34b77d2d16a170fd?hl=en&lnk=gst&q=dynamic+select#34b77d2d16a170fd
and

https://groups.google.com/group/opendatakit/browse_thread/thread/ba6204204ddd17ed/db794f8aba99f07d?hl=en&lnk=gst&q=dynamic+select#db794f8aba99f07d
and think my query is similar. These message are from over a year ago,
so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice much
appreciated.

Cheers,
Alex

OK thanks, I'll take a look at KoboCollect - as we really want to
avoid having 10 different columns in the database in the end (we may
need to join on the subdistrict column).

Cheers,
Alex

··· On May 9, 4:03 pm, Yaw Anokwa wrote: > Alex, > > Each district has to have its own subdistrict prompt. > > relevant="selected(/data/district,'1')"/> > > > SubDistrict1 ASD1_A > SubDistrict1 BSD1_B > > > Yaw > > > > > > > > On Wed, May 9, 2012 at 4:01 AM, Alex Little wrote: > > Hi all, > > > I'm trying to figure out how to have multiple questions store the > > question response in the same instance/nodeset. Not quite sure of a > > better way to explain this, so probably best illustrated with an > > example: > > > Suppose I have one question (/data/district) which has 10 possible > > options, in the next question I want to select which of the 5 > > subdistricts (/data/subdistrict), but I only want to display the > > subdistricts relevant for the selected district (not all 50). I don't > > want to end up with the database having 10 different subdistrict > > columns (only one of which will ever be completed). > > > My first attempt was to have 1 initial question (for the district), > > followed by 10 questions for subdistrict (and controlling which of > > these appeared by using the relevant attribute on the bind node), but > > trying to save the response from any of the 10 subdistrict questions > > in the same /data/subdistrict. Like this: > > > > type="select1"/> > > > relevant="selected(/data/district,'1')"/> > > > relevant="selected(/data/district,'2')"/> > > ... > > and > > > > District > > District 11 > > District 22 > > > > > > Sub District > > SubDistrict ASD_A > > SubDistrict BSD_B > > > > > > Sub District > > SubDistrict CSD_C > > SubDistrict DSD_D > > > > > However, it always shows all of the subdistrict questions. So I also > > tried adding the relevant attribute to the item node, e.g: > > > > type="select1"/> > > > > ... > > > > Sub District > > SubDistrict A > label>SD_A > > SubDistrict B > label>SD_B > > SubDistrict C > label>SD_C > > SubDistrict D > label>SD_D > > > > > but seems this isn't valid syntax (or rather the relevant attribute is > > ignored). > > > For info I saw the messages > >https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0... > > and > >https://groups.google.com/group/opendatakit/browse_thread/thread/ba62... > > and think my query is similar. These message are from over a year ago, > > so wondered if there were any updates? > > > Perhaps I'm approaching this the wrong way? So any help/advice much > > appreciated. > > > Cheers, > > Alex

I believe ODK Collect 1.1.7 and later support itemsets and multiple
blocks in a form (the first is expected to be the one to be
submitted), so you can put your read-only lookups in the other instance
blocks and not have them pollute your submission.

I don't think XLSForm (or Build?) have itemset support.

Mitch

··· On Thu, May 10, 2012 at 12:34 AM, Alex Little wrote:

OK thanks, I'll take a look at KoboCollect - as we really want to
avoid having 10 different columns in the database in the end (we may
need to join on the subdistrict column).

Cheers,
Alex

On May 9, 4:03 pm, Yaw Anokwa yano...@gmail.com wrote:

Alex,

Each district has to have its own subdistrict prompt.

SubDistrict1 ASD1_A SubDistrict1 BSD1_B

Yaw

On Wed, May 9, 2012 at 4:01 AM, Alex Little a...@alexlittle.net wrote:

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure of a
better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10 possible
options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I don't
want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the district),
followed by 10 questions for subdistrict (and controlling which of
these appeared by using the relevant attribute on the bind node), but
trying to save the response from any of the 10 subdistrict questions
in the same /data/subdistrict. Like this:




...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I also
tried adding the relevant attribute to the item node, e.g:



...

Sub District
SubDistrict A</
label>SD_A
SubDistrict B</
label>SD_B
SubDistrict C</
label>SD_C
SubDistrict D</
label>SD_D

but seems this isn't valid syntax (or rather the relevant attribute is
ignored).

For info I saw the messages
https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0.
..

and
https://groups.google.com/group/opendatakit/browse_thread/thread/ba62.
..

and think my query is similar. These message are from over a year ago,
so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice much
appreciated.

Cheers,
Alex

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

XLSForm has alpha-support of something we have been calling
cascading_select that you can use in a pinch, and which automatically does
the subdistrict calculation for you (using if's that I would not want
anyone to write by hand). I'm only advertising here because this is the
developers list; there is still one bug left and we might change the ways
these are specified in the future slightly (expect full release in June).
But again, in a pinch, you can use them already--an idea of how to use it
can be gotten here:
http://formhub.org/pld/forms/cascading_select_test(clone the form, and
hit the webforms icon or download into your phone to
see how it actually operates, but also make sure to check out the data
output; there are calculates in each step of the cascade that gets you to
the value you want for your subdistricts, etc.)

··· On Thu, May 10, 2012 at 12:43 PM, Mitch S wrote:

I believe ODK Collect 1.1.7 and later support itemsets and multiple
blocks in a form (the first is expected to be the one to be
submitted), so you can put your read-only lookups in the other instance
blocks and not have them pollute your submission.

I don't think XLSForm (or Build?) have itemset support.

Mitch

On Thu, May 10, 2012 at 12:34 AM, Alex Little alex@alexlittle.net wrote:

OK thanks, I'll take a look at KoboCollect - as we really want to
avoid having 10 different columns in the database in the end (we may
need to join on the subdistrict column).

Cheers,
Alex

On May 9, 4:03 pm, Yaw Anokwa yano...@gmail.com wrote:

Alex,

Each district has to have its own subdistrict prompt.

SubDistrict1 ASD1_A SubDistrict1 BSD1_B

Yaw

On Wed, May 9, 2012 at 4:01 AM, Alex Little a...@alexlittle.net wrote:

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure of a
better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10 possible
options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I don't
want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the district),
followed by 10 questions for subdistrict (and controlling which of
these appeared by using the relevant attribute on the bind node), but
trying to save the response from any of the 10 subdistrict questions
in the same /data/subdistrict. Like this:




...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I also
tried adding the relevant attribute to the item node, e.g:



...

Sub District
SubDistrict A</
label>SD_A
SubDistrict B</
label>SD_B
SubDistrict C</
label>SD_C
SubDistrict D</
label>SD_D

but seems this isn't valid syntax (or rather the relevant attribute is
ignored).

For info I saw the messages
https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0.
..

and
https://groups.google.com/group/opendatakit/browse_thread/thread/ba62.
..

and think my query is similar. These message are from over a year ago,
so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice much
appreciated.

Cheers,
Alex

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

--
Prabhas Pokharel
http://twitter.com/prabhasp
Nepal mobile: +977 98137 91044
US mobile: +1 347 948 7654
skype/facebook/whatever: prabhasp

Thanks for the replies, I'll look into the itemsets. We only need
support for it in ODK Collect, for us if doesn't matter if XLSForms or
ODK Build supports it or not.

Cheers,
Alex

··· On May 10, 6:58 pm, Prabhas Pokharel wrote: > XLSForm has alpha-support of something we have been calling > cascading_select that you can use in a pinch, and which automatically does > the subdistrict calculation for you (using if's that I would not want > anyone to write by hand). I'm only advertising here because this is the > developers list; there is still one bug left and we might change the ways > these are specified in the future slightly (expect full release in June). > But again, in a pinch, you can use them already--an idea of how to use it > can be gotten here:http://formhub.org/pld/forms/cascading_select_test(clonethe form, and > hit the webforms icon or download into your phone to > see how it actually operates, but also make sure to check out the data > output; there are calculates in each step of the cascade that gets you to > the value you want for your subdistricts, etc.) > > > > > > > > > > On Thu, May 10, 2012 at 12:43 PM, Mitch S wrote: > > I believe ODK Collect 1.1.7 and later support itemsets and multiple > > blocks in a form (the first is expected to be the one to be > > submitted), so you can put your read-only lookups in the other instance > > blocks and not have them pollute your submission. > > > I don't think XLSForm (or Build?) have itemset support. > > > Mitch > > > On Thu, May 10, 2012 at 12:34 AM, Alex Little wrote: > > >> OK thanks, I'll take a look at KoboCollect - as we really want to > >> avoid having 10 different columns in the database in the end (we may > >> need to join on the subdistrict column). > > >> Cheers, > >> Alex > > >> On May 9, 4:03 pm, Yaw Anokwa wrote: > >> > Alex, > > >> > Each district has to have its own subdistrict prompt. > > >> > >> > relevant="selected(/data/district,'1')"/> > > >> > > >> > SubDistrict1 ASD1_A > >> > SubDistrict1 BSD1_B > >> > > > >> > Yaw > > >> > On Wed, May 9, 2012 at 4:01 AM, Alex Little wrote: > >> > > Hi all, > > >> > > I'm trying to figure out how to have multiple questions store the > >> > > question response in the same instance/nodeset. Not quite sure of a > >> > > better way to explain this, so probably best illustrated with an > >> > > example: > > >> > > Suppose I have one question (/data/district) which has 10 possible > >> > > options, in the next question I want to select which of the 5 > >> > > subdistricts (/data/subdistrict), but I only want to display the > >> > > subdistricts relevant for the selected district (not all 50). I don't > >> > > want to end up with the database having 10 different subdistrict > >> > > columns (only one of which will ever be completed). > > >> > > My first attempt was to have 1 initial question (for the district), > >> > > followed by 10 questions for subdistrict (and controlling which of > >> > > these appeared by using the relevant attribute on the bind node), but > >> > > trying to save the response from any of the 10 subdistrict questions > >> > > in the same /data/subdistrict. Like this: > > >> > > >> > > type="select1"/> > >> > > >> > > relevant="selected(/data/district,'1')"/> > >> > > >> > > relevant="selected(/data/district,'2')"/> > >> > > ... > >> > > and > >> > > > >> > > District > >> > > District 11 > >> > > District 22 > >> > > > >> > > > >> > > Sub District > >> > > SubDistrict ASD_A > >> > > SubDistrict BSD_B > >> > > > >> > > > >> > > Sub District > >> > > SubDistrict CSD_C > >> > > SubDistrict DSD_D > >> > > > > >> > > However, it always shows all of the subdistrict questions. So I also > >> > > tried adding the relevant attribute to the item node, e.g: > > >> > > >> > > type="select1"/> > >> > > > >> > > ... > >> > > > >> > > Sub District > >> > > SubDistrict A >> > > label>SD_A > >> > > SubDistrict B >> > > label>SD_B > >> > > SubDistrict C >> > > label>SD_C > >> > > SubDistrict D >> > > label>SD_D > >> > > > > >> > > but seems this isn't valid syntax (or rather the relevant attribute is > >> > > ignored). > > >> > > For info I saw the messages > >> > >https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0. > >> .. > >> > > and > >> > >https://groups.google.com/group/opendatakit/browse_thread/thread/ba62. > >> .. > >> > > and think my query is similar. These message are from over a year ago, > >> > > so wondered if there were any updates? > > >> > > Perhaps I'm approaching this the wrong way? So any help/advice much > >> > > appreciated. > > >> > > Cheers, > >> > > Alex > > > -- > > Mitch Sundt > > Software Engineer > > University of Washington > > mitchellsu...@gmail.com > > -- > Prabhas Pokharelhttp://twitter.com/prabhasp > Nepal mobile: +977 98137 91044 > US mobile: +1 347 948 7654 > skype/facebook/whatever: prabhasp

Prabhas Pokharel
3479487654
@prabhasp

··· On May 11, 2012 5:03 AM, "Alex Little" wrote:

Thanks for the replies, I'll look into the itemsets. We only need
support for it in ODK Collect, for us if doesn't matter if XLSForms or
ODK Build supports it or not.

Cheers,
Alex

On May 10, 6:58 pm, Prabhas Pokharel prabhas.pokha...@gmail.com wrote:

XLSForm has alpha-support of something we have been calling
cascading_select that you can use in a pinch, and which automatically
does
the subdistrict calculation for you (using if's that I would not want
anyone to write by hand). I'm only advertising here because this is the
developers list; there is still one bug left and we might change the ways
these are specified in the future slightly (expect full release in June).
But again, in a pinch, you can use them already--an idea of how to use it
can be gotten here:
http://formhub.org/pld/forms/cascading_select_test(clonethe form, and
hit the webforms icon or download into your phone to
see how it actually operates, but also make sure to check out the data
output; there are calculates in each step of the cascade that gets you to
the value you want for your subdistricts, etc.)

On Thu, May 10, 2012 at 12:43 PM, Mitch S mitchellsu...@gmail.com wrote:

I believe ODK Collect 1.1.7 and later support itemsets and multiple
blocks in a form (the first is expected to be the one to be
submitted), so you can put your read-only lookups in the other instance
blocks and not have them pollute your submission.

I don't think XLSForm (or Build?) have itemset support.

Mitch

On Thu, May 10, 2012 at 12:34 AM, Alex Little a...@alexlittle.net wrote:

OK thanks, I'll take a look at KoboCollect - as we really want to
avoid having 10 different columns in the database in the end (we may
need to join on the subdistrict column).

Cheers,
Alex

On May 9, 4:03 pm, Yaw Anokwa yano...@gmail.com wrote:

Alex,

Each district has to have its own subdistrict prompt.

SubDistrict1 ASD1_A SubDistrict1 BSD1_B

Yaw

On Wed, May 9, 2012 at 4:01 AM, Alex Little a...@alexlittle.net wrote:

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure of
a

better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10 possible
options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I
don't

want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the
district),

followed by 10 questions for subdistrict (and controlling which of
these appeared by using the relevant attribute on the bind node),
but

trying to save the response from any of the 10 subdistrict
questions

in the same /data/subdistrict. Like this:




...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I
also

tried adding the relevant attribute to the item node, e.g:


...

Sub District
SubDistrict
A</

label>SD_A
SubDistrict
B</

label>SD_B
SubDistrict
C</

label>SD_C
SubDistrict
D</

label>SD_D

but seems this isn't valid syntax (or rather the relevant
attribute is

ignored).

For info I saw the messages

https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0.

..

and

https://groups.google.com/group/opendatakit/browse_thread/thread/ba62.

..

and think my query is similar. These message are from over a year
ago,

so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice
much

appreciated.

Cheers,
Alex

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

--
Prabhas Pokharelhttp://twitter.com/prabhasp
Nepal mobile: +977 98137 91044
US mobile: +1 347 948 7654
skype/facebook/whatever: prabhasp

Sorry about the blank message. What I meant to say is that, Alex, I haven't
found a good explanatory resource about itemselects, so you should consider
doing one once you figure out a solution using them.

Prabhas Pokharel
3479487654
@prabhasp

··· On May 11, 2012 7:59 AM, "Prabhas Pokharel" wrote:

Prabhas Pokharel
3479487654
@prabhasp
On May 11, 2012 5:03 AM, "Alex Little" alex@alexlittle.net wrote:

Thanks for the replies, I'll look into the itemsets. We only need
support for it in ODK Collect, for us if doesn't matter if XLSForms or
ODK Build supports it or not.

Cheers,
Alex

On May 10, 6:58 pm, Prabhas Pokharel prabhas.pokha...@gmail.com wrote:

XLSForm has alpha-support of something we have been calling
cascading_select that you can use in a pinch, and which automatically
does
the subdistrict calculation for you (using if's that I would not want
anyone to write by hand). I'm only advertising here because this is the
developers list; there is still one bug left and we might change the
ways
these are specified in the future slightly (expect full release in
June).
But again, in a pinch, you can use them already--an idea of how to use
it
can be gotten here:
http://formhub.org/pld/forms/cascading_select_test(clonethe form, and
hit the webforms icon or download into your phone to
see how it actually operates, but also make sure to check out the data
output; there are calculates in each step of the cascade that gets you
to
the value you want for your subdistricts, etc.)

On Thu, May 10, 2012 at 12:43 PM, Mitch S mitchellsu...@gmail.com wrote:

I believe ODK Collect 1.1.7 and later support itemsets and multiple
blocks in a form (the first is expected to be the one to be
submitted), so you can put your read-only lookups in the other
instance

blocks and not have them pollute your submission.

I don't think XLSForm (or Build?) have itemset support.

Mitch

On Thu, May 10, 2012 at 12:34 AM, Alex Little a...@alexlittle.net wrote:

OK thanks, I'll take a look at KoboCollect - as we really want to
avoid having 10 different columns in the database in the end (we may
need to join on the subdistrict column).

Cheers,
Alex

On May 9, 4:03 pm, Yaw Anokwa yano...@gmail.com wrote:

Alex,

Each district has to have its own subdistrict prompt.

SubDistrict1 ASD1_A SubDistrict1 BSD1_B

Yaw

On Wed, May 9, 2012 at 4:01 AM, Alex Little a...@alexlittle.net wrote:

Hi all,

I'm trying to figure out how to have multiple questions store the
question response in the same instance/nodeset. Not quite sure
of a

better way to explain this, so probably best illustrated with an
example:

Suppose I have one question (/data/district) which has 10
possible

options, in the next question I want to select which of the 5
subdistricts (/data/subdistrict), but I only want to display the
subdistricts relevant for the selected district (not all 50). I
don't

want to end up with the database having 10 different subdistrict
columns (only one of which will ever be completed).

My first attempt was to have 1 initial question (for the
district),

followed by 10 questions for subdistrict (and controlling which
of

these appeared by using the relevant attribute on the bind
node), but

trying to save the response from any of the 10 subdistrict
questions

in the same /data/subdistrict. Like this:


<bind id="subdistrict1" nodeset="/data/subdistrict"
type="select1"

relevant="selected(/data/district,'1')"/>
<bind id="subdistrict2" nodeset="/data/subdistrict"
type="select1"

relevant="selected(/data/district,'2')"/>
...
and

District
District 11
District 22


Sub District
SubDistrict ASD_A
SubDistrict BSD_B


Sub District
SubDistrict CSD_C
SubDistrict DSD_D

However, it always shows all of the subdistrict questions. So I
also

tried adding the relevant attribute to the item node, e.g:


...

Sub District
SubDistrict
A</

label>SD_A
SubDistrict
B</

label>SD_B
SubDistrict
C</

label>SD_C
SubDistrict
D</

label>SD_D

but seems this isn't valid syntax (or rather the relevant
attribute is

ignored).

For info I saw the messages

https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0.

..

and

https://groups.google.com/group/opendatakit/browse_thread/thread/ba62.

..

and think my query is similar. These message are from over a
year ago,

so wondered if there were any updates?

Perhaps I'm approaching this the wrong way? So any help/advice
much

appreciated.

Cheers,
Alex

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

--
Prabhas Pokharelhttp://twitter.com/prabhasp
Nepal mobile: +977 98137 91044
US mobile: +1 347 948 7654
skype/facebook/whatever: prabhasp

Thanks Prabhas - just been trying to figure out how to make this all
work and yes, finding there aren't many simple examples around (of the
full final form XML) to figure things out with. If anyone has a sample
form they know works on ODK I'd be really grateful if you could send
on.

Neil, maybe it would be useful on the link you sent me to put the full
final form xml on this page - I know this would help me in
understanding the how the various bits (instance/nodes/selects etc)
fit together.

In the meantime, I just created a sample from using the Kobo form
designer - giving me this xml: http://pastie.org/3894855

However when I run this through the ODK validator (v1.6), I get these
error messages: http://pastie.org/3894861 . So seems it doesn't like
multiple instance nodes. I tried to edit the form to remove the
multiple instances ( see: http://pastie.org/3894872) but I still get
the error: org.javarosa.xpath.XPathUnsupportedException: XPath
evaluation: unsupported construct [filter expression]

Seems like I will need to switch to Kobo version of ODK, although will
need to add back in the (language/widgets etc) customisations we added
to ODK.

Will certainly post something up once I get it working,
Cheers,
Alex

··· On May 11, 2:02 pm, Prabhas Pokharel wrote: > Sorry about the blank message. What I meant to say is that, Alex, I haven't > found a good explanatory resource about itemselects, so you should consider > doing one once you figure out a solution using them. > > Prabhas Pokharel > 3479487654 > @prabhasp > On May 11, 2012 7:59 AM, "Prabhas Pokharel" wrote: > > > > > > > > > Prabhas Pokharel > > 3479487654 > > @prabhasp > > On May 11, 2012 5:03 AM, "Alex Little" wrote: > > >> Thanks for the replies, I'll look into the itemsets. We only need > >> support for it in ODK Collect, for us if doesn't matter if XLSForms or > >> ODK Build supports it or not. > > >> Cheers, > >> Alex > > >> On May 10, 6:58 pm, Prabhas Pokharel wrote: > >> > XLSForm has alpha-support of something we have been calling > >> > cascading_select that you can use in a pinch, and which automatically > >> does > >> > the subdistrict calculation for you (using if's that I would not want > >> > anyone to write by hand). I'm only advertising here because this is the > >> > developers list; there is still one bug left and we might change the > >> ways > >> > these are specified in the future slightly (expect full release in > >> June). > >> > But again, in a pinch, you can use them already--an idea of how to use > >> it > >> > can be gotten here: > >>http://formhub.org/pld/forms/cascading_select_test(clonetheform, and > >> > hit the webforms icon or download into your phone to > >> > see how it actually operates, but also make sure to check out the data > >> > output; there are calculates in each step of the cascade that gets you > >> to > >> > the value you want for your subdistricts, etc.) > > >> > On Thu, May 10, 2012 at 12:43 PM, Mitch S wrote: > >> > > I believe ODK Collect 1.1.7 and later support itemsets and multiple > >> > > blocks in a form (the first is expected to be the one to be > >> > > submitted), so you can put your read-only lookups in the other > >> instance > >> > > blocks and not have them pollute your submission. > > >> > > I don't think XLSForm (or Build?) have itemset support. > > >> > > Mitch > > >> > > On Thu, May 10, 2012 at 12:34 AM, Alex Little wrote: > > >> > >> OK thanks, I'll take a look at KoboCollect - as we really want to > >> > >> avoid having 10 different columns in the database in the end (we may > >> > >> need to join on the subdistrict column). > > >> > >> Cheers, > >> > >> Alex > > >> > >> On May 9, 4:03 pm, Yaw Anokwa wrote: > >> > >> > Alex, > > >> > >> > Each district has to have its own subdistrict prompt. > > >> > >> > >> > >> > relevant="selected(/data/district,'1')"/> > > >> > >> > > >> > >> > SubDistrict1 ASD1_A > >> > >> > SubDistrict1 BSD1_B > >> > >> > > > >> > >> > Yaw > > >> > >> > On Wed, May 9, 2012 at 4:01 AM, Alex Little wrote: > >> > >> > > Hi all, > > >> > >> > > I'm trying to figure out how to have multiple questions store the > >> > >> > > question response in the same instance/nodeset. Not quite sure > >> of a > >> > >> > > better way to explain this, so probably best illustrated with an > >> > >> > > example: > > >> > >> > > Suppose I have one question (/data/district) which has 10 > >> possible > >> > >> > > options, in the next question I want to select which of the 5 > >> > >> > > subdistricts (/data/subdistrict), but I only want to display the > >> > >> > > subdistricts relevant for the selected district (not all 50). I > >> don't > >> > >> > > want to end up with the database having 10 different subdistrict > >> > >> > > columns (only one of which will ever be completed). > > >> > >> > > My first attempt was to have 1 initial question (for the > >> district), > >> > >> > > followed by 10 questions for subdistrict (and controlling which > >> of > >> > >> > > these appeared by using the relevant attribute on the bind > >> node), but > >> > >> > > trying to save the response from any of the 10 subdistrict > >> questions > >> > >> > > in the same /data/subdistrict. Like this: > > >> > >> > > >> > >> > > type="select1"/> > >> > >> > > >> type="select1" > >> > >> > > relevant="selected(/data/district,'1')"/> > >> > >> > > >> type="select1" > >> > >> > > relevant="selected(/data/district,'2')"/> > >> > >> > > ... > >> > >> > > and > >> > >> > > > >> > >> > > District > >> > >> > > District 11 > >> > >> > > District 22 > >> > >> > > > >> > >> > > > >> > >> > > Sub District > >> > >> > > SubDistrict ASD_A > >> > >> > > SubDistrict BSD_B > >> > >> > > > >> > >> > > > >> > >> > > Sub District > >> > >> > > SubDistrict CSD_C > >> > >> > > SubDistrict DSD_D > >> > >> > > > > >> > >> > > However, it always shows all of the subdistrict questions. So I > >> also > >> > >> > > tried adding the relevant attribute to the item node, e.g: > > >> > >> > > >> > >> > > type="select1"/> > >> > >> > > >> type="select1" /> > >> > >> > > ... > >> > >> > > > >> > >> > > Sub District > >> > >> > > SubDistrict > >> A >> > >> > > label>SD_A > >> > >> > > SubDistrict > >> B >> > >> > > label>SD_B > >> > >> > > SubDistrict > >> C >> > >> > > label>SD_C > >> > >> > > SubDistrict > >> D >> > >> > > label>SD_D > >> > >> > > > > >> > >> > > but seems this isn't valid syntax (or rather the relevant > >> attribute is > >> > >> > > ignored). > > >> > >> > > For info I saw the messages > > >>https://groups.google.com/group/opendatakit/browse_thread/thread/e5d0. > >> > >> .. > >> > >> > > and > > >>https://groups.google.com/group/opendatakit/browse_thread/thread/ba62. > >> > >> .. > >> > >> > > and think my query is similar. These message are from over a > >> year ago, > >> > >> > > so wondered if there were any updates? > > >> > >> > > Perhaps I'm approaching this the wrong way? So any help/advice > >> much > >> > >> > > appreciated. > > >> > >> > > Cheers, > >> > >> > > Alex > > >> > > -- > >> > > Mitch Sundt > >> > > Software Engineer > >> > > University of Washington > >> > > mitchellsu...@gmail.com > > >> > -- > >> > Prabhas Pokharelhttp://twitter.com/prabhasp > >> > Nepal mobile: +977 98137 91044 > >> > US mobile: +1 347 948 7654 > >> > skype/facebook/whatever: prabhasp

Alex,
I tested your survey using KoBoCollect version of ODK and it does work
fine. Your itemsets are good and let you make cascading district and
sub-district selections. Nice work.

☞§※☼:airplane::open_umbrella::slight_smile:
~Neil

This should just be a javarosa library upgrade, as all the itemset logic
and the errors you are seeing are from the javarosa library.

If you take the library from the KoBoCollect version and drop it into the
ODK version, it should all just work.

Mitch

··· On Fri, May 11, 2012 at 11:03 AM, Neil Hendrick wrote:

Alex,
I tested your survey using KoBoCollect version of ODK and it does work
fine. Your itemsets are good and let you make cascading district and
sub-district selections. Nice work.

☞§※☼:airplane::open_umbrella::slight_smile:
~Neil

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