Out filter of item in select-one question depending on previous question

Peter,

It is possible to lay out the questions you're describing with an
construct in CommCare.

It's a somewhat advanced setup currently, but the process is documented at

https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

Please let me know if you have any questions
-Clayton

··· -----Original Message----- From: "Peter D Lubambi" Reply-To: "Peter D Lubambi" Date: Tue, 16 Oct 2012 16:48:32 +0300 To: "commcare-support@dimagi.com" Subject: Out filter of item in select-one question depending on previous question

Hello,
In my application I want to be able to register routes (origin location and
destination) and price for the route, then to use this information to auto
fill the price on the other form just after filling or selecting route. Is
this something can be supported by commcare?, Is it possible to populate
the single-select list in the other form with the list of routes
registered?

Also- I want to be able to filter the list depending on the answer on the
previous question, for example first question is the district name and next
is village name (all are single select), on the second question i want to
see only list of villages belong to the district selected on the first
question.

Thanks.

Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087

Hi Clayton,
I have tried to follow the instruction on this link
https://bitbucket.org/commcare/commcare/wiki/casedb you provided. It sound
unclear to me on how implement this on my from.
Few questions to help me get started.....

  1. I have added this node withing the instance, at the bottom just before
    .... Is this the right place?
<*/> <* case_type=""/> ...
  1. Is there any difference between case_type and case_id, because on the
    page where we define case we only have case type field and for this is
    "route". Is it correct to refer to this as case_id?
  2. owner_id="D-Tree tester", this is group name. Is this correct to refer
    to it as owner_id?
  3. index node- what is this for ? how is this affect the functioning on
    the case db? Tying to figure out if I need this?

Have someone done something similar to what I am trying to do? will be very
helpful if I could get the form which have this implementation!

thanks.

··· On Fri, Dec 21, 2012 at 10:05 AM, Clayton Sims wrote:

Peter,

You can create a module to register routes as cases, and then use the
itemset construct in the other module to select from that list of cases
using the casedb connector documented here

https://bitbucket.org/commcare/commcare/wiki/casedb

-Clayton

On Thu, Dec 20, 2012 at 3:23 PM, Peter D Lubambi plubambi@gmail.comwrote:

Hi Clayton,
I have followed the instruction on the link you directed me, which
answered my second question.

Left with the first question:- I want to register routes on one form and
load those routes as options(item select) in one of the questions in
another form, see more description on my original email.
Thanks.

On Tue, Oct 16, 2012 at 6:59 PM, Clayton Sims csims@dimagi.com wrote:

Peter,

It is possible to lay out the questions you're describing with an
construct in CommCare.

It's a somewhat advanced setup currently, but the process is documented
at

https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

Please let me know if you have any questions
-Clayton

-----Original Message-----
From: "Peter D Lubambi" plubambi@gmail.com
Reply-To: "Peter D Lubambi" plubambi@gmail.com
Date: Tue, 16 Oct 2012 16:48:32 +0300
To: "commcare-support@dimagi.com" commcare-support@dimagi.com
Subject: Out filter of item in select-one question depending on previous
question

Hello,
In my application I want to be able to register routes (origin location
and
destination) and price for the route, then to use this information to
auto
fill the price on the other form just after filling or selecting route.
Is
this something can be supported by commcare?, Is it possible to populate
the single-select list in the other form with the list of routes
registered?

Also- I want to be able to filter the list depending on the answer on
the
previous question, for example first question is the district name and
next
is village name (all are single select), on the second question i want
to
see only list of villages belong to the district selected on the first
question.

Thanks.

Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

Peter,

So the casedb connector is an External Instance in XForms, which you link
to by specifying an additional with the proper source and then
referencing with the instance() nodeset method.

Please read up on artificial external instances from the page linked at the
top of the casedb page:
https://bitbucket.org/javarosa/javarosa/wiki/externalinstances

You shouldn't need to add any instance nodes to your form, you can
reference the instance nodes for the existing cases using the syntax
covered on the commcare wiki (NOTE you can ignore everything on this page
other than the "Create a Select List Based on a Fixture" section, which
outlines the syntax for referencing a nodeset from an external instance):
https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

-Clayton

··· On Wed, Jan 2, 2013 at 5:03 AM, Peter D Lubambi wrote:

Hi Clayton,
I have tried to follow the instruction on this link
https://bitbucket.org/commcare/commcare/wiki/casedb you provided. It
sound unclear to me on how implement this on my from.
Few questions to help me get started.....

  1. I have added this node withing the instance, at the bottom just before
    .... Is this the right place?
<*/> <* case_type=""/> ...
  1. Is there any difference between case_type and case_id, because on the
    page where we define case we only have case type field and for this is
    "route". Is it correct to refer to this as case_id?
  2. owner_id="D-Tree tester", this is group name. Is this correct to refer
    to it as owner_id?
  3. index node- what is this for ? how is this affect the functioning on
    the case db? Tying to figure out if I need this?

Have someone done something similar to what I am trying to do? will be
very helpful if I could get the form which have this implementation!

thanks.

On Fri, Dec 21, 2012 at 10:05 AM, Clayton Sims csims@dimagi.com wrote:

Peter,

You can create a module to register routes as cases, and then use the
itemset construct in the other module to select from that list of cases
using the casedb connector documented here

https://bitbucket.org/commcare/commcare/wiki/casedb

-Clayton

On Thu, Dec 20, 2012 at 3:23 PM, Peter D Lubambi plubambi@gmail.comwrote:

Hi Clayton,
I have followed the instruction on the link you directed me, which
answered my second question.

Left with the first question:- I want to register routes on one form and
load those routes as options(item select) in one of the questions in
another form, see more description on my original email.
Thanks.

On Tue, Oct 16, 2012 at 6:59 PM, Clayton Sims csims@dimagi.com wrote:

Peter,

It is possible to lay out the questions you're describing with an
construct in CommCare.

It's a somewhat advanced setup currently, but the process is documented
at

https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

Please let me know if you have any questions
-Clayton

-----Original Message-----
From: "Peter D Lubambi" plubambi@gmail.com
Reply-To: "Peter D Lubambi" plubambi@gmail.com
Date: Tue, 16 Oct 2012 16:48:32 +0300
To: "commcare-support@dimagi.com" commcare-support@dimagi.com
Subject: Out filter of item in select-one question depending on
previous question

Hello,
In my application I want to be able to register routes (origin
location and
destination) and price for the route, then to use this information to
auto
fill the price on the other form just after filling or selecting
route. Is
this something can be supported by commcare?, Is it possible to
populate
the single-select list in the other form with the list of routes
registered?

Also- I want to be able to filter the list depending on the answer on
the
previous question, for example first question is the district name and
next
is village name (all are single select), on the second question i want
to
see only list of villages belong to the district selected on the first
question.

Thanks.

Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

Hi Clayton,
Thanks for the reference you provided. It was helpful!
I have tried to implement the functionality in my form attached, though I
have not been able to test as the validator throw this error wherever I
upload the form.

Any help will be appreciated
Thanks,

Validation Error:
Warning: 1 Unrecognized attributes found in Element [data] and will be
ignored: [name] Location:
Problem found at nodeset: /html/head/model/instance/data
With element <reason_for_referral/>
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:399)
at
org.javarosa.xform.schema.InstanceSchema.processSelectChoices(InstanceSchema.java:174)

at
org.javarosa.xform.schema.InstanceSchema.processSelectChoices(InstanceSchema.java:179)

at
org.javarosa.xform.schema.InstanceSchema.processSelectChoices(InstanceSchema.java:179)

at
org.javarosa.xform.schema.InstanceSchema.generateInstanceSchema(InstanceSchema.java:60)

at org.javarosa.xform.schema.Harness.main(Harness.java:138)

before_upload.xml (10.2 KB)

··· On Wed, Jan 2, 2013 at 7:49 PM, Clayton Sims wrote:

Peter,

So the casedb connector is an External Instance in XForms, which you link
to by specifying an additional with the proper source and then
referencing with the instance() nodeset method.

Please read up on artificial external instances from the page linked at
the top of the casedb page:
javarosa / javarosa / wiki / externalinstances — Bitbucket

You shouldn't need to add any instance nodes to your form, you can
reference the instance nodes for the existing cases using the syntax
covered on the commcare wiki (NOTE you can ignore everything on this
page other than the "Create a Select List Based on a Fixture" section,
which outlines the syntax for referencing a nodeset from an external
instance):
https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

-Clayton

On Wed, Jan 2, 2013 at 5:03 AM, Peter D Lubambi plubambi@gmail.comwrote:

Hi Clayton,
I have tried to follow the instruction on this link
https://bitbucket.org/commcare/commcare/wiki/casedb you provided. It
sound unclear to me on how implement this on my from.
Few questions to help me get started.....

  1. I have added this node withing the instance, at the bottom just before
    .... Is this the right place?
<*/> <* case_type=""/> ...
  1. Is there any difference between case_type and case_id, because on the
    page where we define case we only have case type field and for this is
    "route". Is it correct to refer to this as case_id?
  2. owner_id="D-Tree tester", this is group name. Is this correct to refer
    to it as owner_id?
  3. index node- what is this for ? how is this affect the functioning on
    the case db? Tying to figure out if I need this?

Have someone done something similar to what I am trying to do? will be
very helpful if I could get the form which have this implementation!

thanks.

On Fri, Dec 21, 2012 at 10:05 AM, Clayton Sims csims@dimagi.com wrote:

Peter,

You can create a module to register routes as cases, and then use the
itemset construct in the other module to select from that list of cases
using the casedb connector documented here

https://bitbucket.org/commcare/commcare/wiki/casedb

-Clayton

On Thu, Dec 20, 2012 at 3:23 PM, Peter D Lubambi plubambi@gmail.comwrote:

Hi Clayton,
I have followed the instruction on the link you directed me, which
answered my second question.

Left with the first question:- I want to register routes on one form
and load those routes as options(item select) in one of the questions in
another form, see more description on my original email.
Thanks.

On Tue, Oct 16, 2012 at 6:59 PM, Clayton Sims csims@dimagi.com wrote:

Peter,

It is possible to lay out the questions you're describing with an
construct in CommCare.

It's a somewhat advanced setup currently, but the process is
documented at

https://confluence.dimagi.com/display/commcarepublic/Conditional+Select+Options

Please let me know if you have any questions
-Clayton

-----Original Message-----
From: "Peter D Lubambi" plubambi@gmail.com
Reply-To: "Peter D Lubambi" plubambi@gmail.com
Date: Tue, 16 Oct 2012 16:48:32 +0300
To: "commcare-support@dimagi.com" commcare-support@dimagi.com
Subject: Out filter of item in select-one question depending on
previous question

Hello,
In my application I want to be able to register routes (origin
location and
destination) and price for the route, then to use this information to
auto
fill the price on the other form just after filling or selecting
route. Is
this something can be supported by commcare?, Is it possible to
populate
the single-select list in the other form with the list of routes
registered?

Also- I want to be able to filter the list depending on the answer on
the
previous question, for example first question is the district name
and next
is village name (all are single select), on the second question i
want to
see only list of villages belong to the district selected on the first
question.

Thanks.

Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

--
Peter Dotto Lubambi,
Information Technology Officer,
D-tree International,
Tanzania.
+255 786 087 087
PPP: http://tz.linkedin.com/in/plubambi

Peter,

Is this due to the problem that you sent earlier where HQ was mangling the
XForm markup? That seems like it's a fit for the error you're experience
here.

-Clayton

··· On Wed, Jan 9, 2013 at 8:25 AM, Peter D Lubambi wrote:

.processSelectChoices(InstanceSchema.java:174)
at
org.javarosa.xform.schema.InstanceSchema.processSelectChoices(InstanceSchema.java:179)

at
org.javarosa.xform.schema.InstanceSchema.processSelectChoices(InstanceSchema.java:179)

at
org.javarosa.xform.schema.InstanceSchema.generateInstanceSchema(InstanceSchema.java:60)

at org.javarosa.xform.schema.Harness.main(Harness