Apply skip logic to items in a select list

We are currently using a select list to help schedule future visits, where
the list items include "tomorrow", "in one week", etc. Ideally, we would
like to reduce the number of available items based on the EDD...to force
the next prenatal visit to be scheduled before the EDD. While I'm pretty
sure that Vellum/CC 1.3 does not (yet) support applying skip logic to
individual items, I seem to remember talk about this being possible in the
future.

So, my question is: is it possible to dynamically reduce (or increase)
the items in a select list using "custom" xform xml?

Thanks, Ray

Ray,

This is fairly straightforward with itemsets and
predicate expressions CommCare 2.0 (although we don't yet support them in
Vellum, you'd need to write a custom xform), but it's not particularly easy
in CommCare 1.3.

You can see an example (although more complex than what you need) itemsets
in commcare 1.3 at

https://bitbucket.org/commcare/commcare-apps/src/2aa2ad268ded/commcare-fp/fp_form.xml

Search for itemset to see the xml constructs. The basic idea is to use a
repeated structure for the itemset, but to reference the nodes with a
single (somewhat awkward) bind. In 2.0 you would accomplish this in a
similar way, but using predicate expressions to define the relevancy
conditions one at a time.

-Clayton

··· On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote:

We are currently using a select list to help schedule future visits, where
the list items include "tomorrow", "in one week", etc. Ideally, we would
like to reduce the number of available items based on the EDD...to force
the next prenatal visit to be scheduled before the EDD. While I'm pretty
sure that Vellum/CC 1.3 does not (yet) support applying skip logic to
individual items, I seem to remember talk about this being possible in the
future.

So, my question is: is it possible to dynamically reduce (or increase)
the items in a select list using "custom" xform xml?

Thanks, Ray

Clayton,

You previously wrote: "This is fairly straightforward with itemsets and
predicate expressions CommCare 2.0..
."

Now that we are starting to look at 2.0, I would like to customize our
select item lists. Could you point me to a CC 2.0 example of how to
accomplish this?

Our specific use case: when presenting the CHW with options for the the
next scheduled postpartum visit date, eliminate items that are more than 40
days after the actual delivery date (e.g. drop the 'in 3 weeks" option if
the delivery occurred 2 weeks ago)

Thanks, Ray

··· On Saturday, May 19, 2012 7:36:56 AM UTC-4, Clayton Sims wrote: > > Ray, > > This is fairly straightforward with itemsets and > predicate expressions CommCare 2.0 (although we don't yet support them in > Vellum, you'd need to write a custom xform), but it's not particularly easy > in CommCare 1.3. > > You can see an example (although more complex than what you need) itemsets > in commcare 1.3 at > > > https://bitbucket.org/commcare/commcare-apps/src/2aa2ad268ded/commcare-fp/fp_form.xml > > > Search for itemset to see the xml constructs. The basic idea is to use a > repeated structure for the itemset, but to reference the nodes with a > single (somewhat awkward) bind. In 2.0 you would accomplish this in a > similar way, but using predicate expressions to define the relevancy > conditions one at a time. > > -Clayton > > On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote: > >> We are currently using a select list to help schedule future visits, >> where the list items include "tomorrow", "in one week", etc. Ideally, we >> would like to reduce the number of available items based on the EDD...to >> force the next prenatal visit to be scheduled before the EDD. While I'm >> pretty sure that Vellum/CC 1.3 does not (yet) support applying skip logic >> to individual items, I seem to remember talk about this being possible in >> the future. >> >> So, *my question is*: is it possible to dynamically reduce (or increase) >> the items in a select list using "custom" xform xml? >> >> Thanks, Ray >> > >

Ray,

This is accomplished in a very similar manner to the 1.3 form I sent, but
in a much more straightforward way.

I whipped up a quick guide at

http://confluence.dimagi.com/display/commcarepublic/CommCare+2.0+XForms+Introduction

-Clayton

··· On Wed, May 30, 2012 at 7:18 PM, Ray Brunsting wrote:

Clayton,

You previously wrote: "This is fairly straightforward with itemsets and
predicate expressions CommCare 2.0..
."

Now that we are starting to look at 2.0, I would like to customize our
select item lists. Could you point me to a CC 2.0 example of how to
accomplish this?

Our specific use case: when presenting the CHW with options for the the
next scheduled postpartum visit date, eliminate items that are more than 40
days after the actual delivery date (e.g. drop the 'in 3 weeks" option if
the delivery occurred 2 weeks ago)

Thanks, Ray

On Saturday, May 19, 2012 7:36:56 AM UTC-4, Clayton Sims wrote:

Ray,

This is fairly straightforward with itemsets and
predicate expressions CommCare 2.0 (although we don't yet support them in
Vellum, you'd need to write a custom xform), but it's not particularly easy
in CommCare 1.3.

You can see an example (although more complex than what you need)
itemsets in commcare 1.3 at

https://bitbucket.org/**commcare/commcare-apps/src/**
2aa2ad268ded/commcare-fp/fp_**form.xmlhttps://bitbucket.org/commcare/commcare-apps/src/2aa2ad268ded/commcare-fp/fp_form.xml

Search for itemset to see the xml constructs. The basic idea is to use a
repeated structure for the itemset, but to reference the nodes with a
single (somewhat awkward) bind. In 2.0 you would accomplish this in a
similar way, but using predicate expressions to define the relevancy
conditions one at a time.

-Clayton

On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote:

We are currently using a select list to help schedule future visits,
where the list items include "tomorrow", "in one week", etc. Ideally, we
would like to reduce the number of available items based on the EDD...to
force the next prenatal visit to be scheduled before the EDD. While I'm
pretty sure that Vellum/CC 1.3 does not (yet) support applying skip logic
to individual items, I seem to remember talk about this being possible in
the future.

So, my question is: is it possible to dynamically reduce (or
increase) the items in a select list using "custom" xform xml?

Thanks, Ray

Hi Clayton -- I haven't been able to get this example working. I'm trying
to have enumerators pick a Province and then a District. I'd like to hide
certain district options based on the choice of Province. Here's the form
I'm using:
https://github.com/Aquaya/SDSMAS/blob/master/sdsmas-water-quality-xform.xml

When I upload this to a test phone and pick a Province, I still see all of
the District options. I'm on CommCare 2.0. Any ideas?

Matt

··· On Wednesday, May 30, 2012 11:14:44 PM UTC-7, Clayton Sims wrote: > > Ray, > > This is accomplished in a very similar manner to the 1.3 form I sent, but > in a much more straightforward way. > > I whipped up a quick guide at > > > http://confluence.dimagi.com/display/commcarepublic/CommCare+2.0+XForms+Introduction > > -Clayton > > On Wed, May 30, 2012 at 7:18 PM, Ray Brunsting wrote: > >> Clayton, >> >> You previously wrote: "*This is fairly straightforward with itemsets and >> predicate expressions CommCare 2.0..*." >> >> Now that we are starting to look at 2.0, I would like to customize our >> select item lists. Could you point me to a CC 2.0 example of how to >> accomplish this? >> >> Our specific use case: when presenting the CHW with options for the the >> next scheduled postpartum visit date, eliminate items that are more than 40 >> days after the actual delivery date (e.g. drop the 'in 3 weeks" option if >> the delivery occurred 2 weeks ago) >> >> Thanks, Ray >> >> >> On Saturday, May 19, 2012 7:36:56 AM UTC-4, Clayton Sims wrote: >> >>> Ray, >>> >>> This is fairly straightforward with itemsets and >>> predicate expressions CommCare 2.0 (although we don't yet support them in >>> Vellum, you'd need to write a custom xform), but it's not particularly easy >>> in CommCare 1.3. >>> >>> You can see an example (although more complex than what you need) >>> itemsets in commcare 1.3 at >>> >>> https://bitbucket.org/**commcare/commcare-apps/src/** >>> 2aa2ad268ded/commcare-fp/fp_**form.xml >>> >>> >>> Search for itemset to see the xml constructs. The basic idea is to use a >>> repeated structure for the itemset, but to reference the nodes with a >>> single (somewhat awkward) bind. In 2.0 you would accomplish this in a >>> similar way, but using predicate expressions to define the relevancy >>> conditions one at a time. >>> >>> -Clayton >>> >>> >>> On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote: >>> >>>> We are currently using a select list to help schedule future visits, >>>> where the list items include "tomorrow", "in one week", etc. Ideally, we >>>> would like to reduce the number of available items based on the EDD...to >>>> force the next prenatal visit to be scheduled before the EDD. While I'm >>>> pretty sure that Vellum/CC 1.3 does not (yet) support applying skip logic >>>> to individual items, I seem to remember talk about this being possible in >>>> the future. >>>> >>>> So, *my question is*: is it possible to dynamically reduce (or >>>> increase) the items in a select list using "custom" xform xml? >>>> >>>> Thanks, Ray >>>> >>> >>> >

Matt,

I'll look over this form and let you know, but I also should tell you that
there's a much simpler way to structure the form you've set up here. you
could instead try

.... ...

...

<select1 ref="/data/selectedprovince">
  <label ref="jr:itext('province-label')" />
  <itemset nodeset="/data/provinces/province">
    <label ref="jr:itext(@id)" />
    <value ref="@id" />
  </itemset>
</select1>

<select1 ref="/data/selecteddistrict">
  <label ref="jr:itext('district-label')" />
  <itemset

nodeset="/data/provinces/province[@id=/data/selectedprovince]/district">



This design allows you to get around any issues you're having with the
current setup, and is a lot cleaner (you don't need a bind for every
district). Future districts/provinces can be added purely to the instance
model and to the itext.

-Clayton

··· On Fri, Jul 13, 2012 at 8:49 PM, Matt Ball wrote:

Hi Clayton -- I haven't been able to get this example working. I'm trying
to have enumerators pick a Province and then a District. I'd like to hide
certain district options based on the choice of Province. Here's the form
I'm using:
https://github.com/Aquaya/SDSMAS/blob/master/sdsmas-water-quality-xform.xml

When I upload this to a test phone and pick a Province, I still see all of
the District options. I'm on CommCare 2.0. Any ideas?

Matt

On Wednesday, May 30, 2012 11:14:44 PM UTC-7, Clayton Sims wrote:

Ray,

This is accomplished in a very similar manner to the 1.3 form I sent, but
in a much more straightforward way.

I whipped up a quick guide at

Dashboard - Dimagi Confluence**
CommCare+2.0+XForms+**Introductionhttp://confluence.dimagi.com/display/commcarepublic/CommCare+2.0+XForms+Introduction

-Clayton

On Wed, May 30, 2012 at 7:18 PM, Ray Brunsting ray@tula.org wrote:

Clayton,

You previously wrote: "This is fairly straightforward with itemsets
and predicate expressions CommCare 2.0..
."

Now that we are starting to look at 2.0, I would like to customize our
select item lists. Could you point me to a CC 2.0 example of how to
accomplish this?

Our specific use case: when presenting the CHW with options for the the
next scheduled postpartum visit date, eliminate items that are more than 40
days after the actual delivery date (e.g. drop the 'in 3 weeks" option if
the delivery occurred 2 weeks ago)

Thanks, Ray

On Saturday, May 19, 2012 7:36:56 AM UTC-4, Clayton Sims wrote:

Ray,

This is fairly straightforward with itemsets and
predicate expressions CommCare 2.0 (although we don't yet support them in
Vellum, you'd need to write a custom xform), but it's not particularly easy
in CommCare 1.3.

You can see an example (although more complex than what you need)
itemsets in commcare 1.3 at

https://bitbucket.org/**commcare**/commcare-apps/src/**2aa2ad268de**
d/commcare-fp/fp_**form.xmlhttps://bitbucket.org/commcare/commcare-apps/src/2aa2ad268ded/commcare-fp/fp_form.xml

Search for itemset to see the xml constructs. The basic idea is to use
a repeated structure for the itemset, but to reference the nodes with a
single (somewhat awkward) bind. In 2.0 you would accomplish this in a
similar way, but using predicate expressions to define the relevancy
conditions one at a time.

-Clayton

On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote:

We are currently using a select list to help schedule future visits,
where the list items include "tomorrow", "in one week", etc. Ideally, we
would like to reduce the number of available items based on the EDD...to
force the next prenatal visit to be scheduled before the EDD. While I'm
pretty sure that Vellum/CC 1.3 does not (yet) support applying skip logic
to individual items, I seem to remember talk about this being possible in
the future.

So, my question is: is it possible to dynamically reduce (or
increase) the items in a select list using "custom" xform xml?

Thanks, Ray

Thanks a lot Clayton, I've been testing this structure today and it's far
better. Appreciate the help!

Matt

··· On Monday, July 16, 2012 7:37:49 AM UTC-7, Clayton Sims wrote: > > Matt, > > I'll look over this form and let you know, but I also should tell you that > there's a much simpler way to structure the form you've set up here. you > could instead try > > > > > > > > .... > > > > ... > > > > > > > ... > > > > > > > > > > > > nodeset="/data/provinces/province[@id=/data/selectedprovince]/district"> > > > > > > This design allows you to get around any issues you're having with the > current setup, and is a lot cleaner (you don't need a bind for every > district). Future districts/provinces can be added purely to the instance > model and to the itext. > > -Clayton > > On Fri, Jul 13, 2012 at 8:49 PM, Matt Ball wrote: > >> Hi Clayton -- I haven't been able to get this example working. I'm >> trying to have enumerators pick a Province and then a District. I'd like >> to hide certain district options based on the choice of Province. Here's >> the form I'm using: >> https://github.com/Aquaya/SDSMAS/blob/master/sdsmas-water-quality-xform.xml >> >> When I upload this to a test phone and pick a Province, I still see all >> of the District options. I'm on CommCare 2.0. Any ideas? >> >> Matt >> >> >> On Wednesday, May 30, 2012 11:14:44 PM UTC-7, Clayton Sims wrote: >>> >>> Ray, >>> >>> This is accomplished in a very similar manner to the 1.3 form I sent, >>> but in a much more straightforward way. >>> >>> I whipped up a quick guide at >>> >>> http://confluence.dimagi.com/**display/commcarepublic/** >>> CommCare+2.0+XForms+**Introduction >>> >>> -Clayton >>> >>> On Wed, May 30, 2012 at 7:18 PM, Ray Brunsting wrote: >>> >>>> Clayton, >>>> >>>> You previously wrote: "*This is fairly straightforward with itemsets >>>> and predicate expressions CommCare 2.0..*." >>>> >>>> Now that we are starting to look at 2.0, I would like to customize our >>>> select item lists. Could you point me to a CC 2.0 example of how to >>>> accomplish this? >>>> >>>> Our specific use case: when presenting the CHW with options for the the >>>> next scheduled postpartum visit date, eliminate items that are more than 40 >>>> days after the actual delivery date (e.g. drop the 'in 3 weeks" option if >>>> the delivery occurred 2 weeks ago) >>>> >>>> Thanks, Ray >>>> >>>> >>>> On Saturday, May 19, 2012 7:36:56 AM UTC-4, Clayton Sims wrote: >>>> >>>>> Ray, >>>>> >>>>> This is fairly straightforward with itemsets and >>>>> predicate expressions CommCare 2.0 (although we don't yet support them in >>>>> Vellum, you'd need to write a custom xform), but it's not particularly easy >>>>> in CommCare 1.3. >>>>> >>>>> You can see an example (although more complex than what you need) >>>>> itemsets in commcare 1.3 at >>>>> >>>>> https://bitbucket.org/**commcare**/commcare-apps/src/**2aa2ad268de** >>>>> d/commcare-fp/fp_**form.xml >>>>> >>>>> >>>>> Search for itemset to see the xml constructs. The basic idea is to use >>>>> a repeated structure for the itemset, but to reference the nodes with a >>>>> single (somewhat awkward) bind. In 2.0 you would accomplish this in a >>>>> similar way, but using predicate expressions to define the relevancy >>>>> conditions one at a time. >>>>> >>>>> -Clayton >>>>> >>>>> >>>>> On Fri, May 18, 2012 at 2:48 PM, Ray Brunsting wrote: >>>>> >>>>>> We are currently using a select list to help schedule future visits, >>>>>> where the list items include "tomorrow", "in one week", etc. Ideally, we >>>>>> would like to reduce the number of available items based on the EDD...to >>>>>> force the next prenatal visit to be scheduled before the EDD. While I'm >>>>>> pretty sure that Vellum/CC 1.3 does not (yet) support applying skip logic >>>>>> to individual items, I seem to remember talk about this being possible in >>>>>> the future. >>>>>> >>>>>> So, *my question is*: is it possible to dynamically reduce (or >>>>>> increase) the items in a select list using "custom" xform xml? >>>>>> >>>>>> Thanks, Ray >>>>>> >>>>> >>>>> >>> >