# Filtering cases when using cases as multiple choice options

**URL:** <https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185>\
**Category:** Users\
**Created:** [January 12, 2017, 10:51am UTC](https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185 "2017-01-12T10:51:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Jospe](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/54ee81/32.png) [@Eric\_Jospe](https://forum.dimagi.com/u/Eric_Jospe)\
**Post date:** [January 12, 2017, 10:51am UTC](https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185/1 "2017-01-12T10:51:37Z")

</div>

I created a form with a multiple select question with cases as options. On  
this  
[https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices](https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices)  
help page, it says that you can restrict the cases shown to be only open  
cases by appending a [@status='open'] clause. I would like to further  
filter this list based on a case property (Status = 'Enrolled'). I tried  
appending this in the same way but got an error message saying it could not  
find that path. Here's the section of the XML code:

Is there a way to do this?

Thanks!

---

<div class="post-metadata">

**Author:** ![czue](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/czue/32/493_2.png) [@czue](https://forum.dimagi.com/u/czue)\
**Post date:** [January 12, 2017, 11:06am UTC](https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185/2 "2017-01-12T11:06:14Z")

</div>

Hi Eric,

For normal case property you should remove the @ sign. So it should be  
ce('casedb')/casedb/case[@case\_type='ANC'][@status = 'open'][Status =  
'Enrolled']

> **···**
>
> On Thu, Jan 12, 2017 at 4:21 PM, Eric Jospe wrote:
> 
> > I created a form with a multiple select question with cases as options. On  
> > this  
> > [https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices](https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices)  
> > help page, it says that you can restrict the cases shown to be only open  
> > cases by appending a [@status='open'] clause. I would like to further  
> > filter this list based on a case property (Status = 'Enrolled'). I tried  
> > appending this in the same way but got an error message saying it could not  
> > find that path. Here's the section of the XML code:
> > 
> > Is there a way to do this?
> > 
> > Thanks!
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "commcare-users" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Eric\_Jospe](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/54ee81/32.png) [@Eric\_Jospe](https://forum.dimagi.com/u/Eric_Jospe)\
**Post date:** [January 12, 2017, 12:07pm UTC](https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185/3 "2017-01-12T12:07:57Z")

</div>

Thanks, Cory! That works.

-Eric

> **···**
>
> On Thu, Jan 12, 2017 at 1:06 PM, Cory Zue wrote:
> 
> > Hi Eric,
> > 
> > For normal case property you should remove the @ sign. So it should be  
> > ce('casedb')/casedb/case[@case\_type='ANC'][@status = 'open'][Status =  
> > 'Enrolled']
> > 
> > On Thu, Jan 12, 2017 at 4:21 PM, Eric Jospe [eric.jospe@gmail.com](mailto:eric.jospe@gmail.com) wrote:
> > 
> > > I created a form with a multiple select question with cases as options.  
> > > On this  
> > > [https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices](https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices)  
> > > help page, it says that you can restrict the cases shown to be only open  
> > > cases by appending a [@status='open'] clause. I would like to further  
> > > filter this list based on a case property (Status = 'Enrolled'). I tried  
> > > appending this in the same way but got an error message saying it could not  
> > > find that path. Here's the section of the XML code:
> > > 
> > > Is there a way to do this?
> > > 
> > > Thanks!
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "commcare-users" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "commcare-users" group.  
> > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > topic/commcare-users/tQxKAmObKxA/unsubscribe.  
> > To unsubscribe from this group and all its topics, send an email to  
> > [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Eric\_Jospe](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/e/54ee81/32.png) [@Eric\_Jospe](https://forum.dimagi.com/u/Eric_Jospe)\
**Post date:** [January 13, 2017, 9:36am UTC](https://forum.dimagi.com/t/filtering-cases-when-using-cases-as-multiple-choice-options/3185/4 "2017-01-13T09:36:19Z")

</div>

Hey Cory, quick follow-up question. Rather than having all open cases for  
each owner group displayed, I'd like only the cases of a particular  
location (cell) to appear, depending on where the training is taking place  
on any given day. There's a cell lookup table, and cells are also case  
properties assigned to each case. However, when I tried adding the cell  
lookup table and filtering the cases based on that, no cases showed up in  
the form. Is it possible to do this another way?

Thanks!

-Eric

> **···**
>
> On Thu, Jan 12, 2017 at 2:07 PM, Eric Jospe wrote:
> 
> > Thanks, Cory! That works.
> > 
> > -Eric
> > 
> > On Thu, Jan 12, 2017 at 1:06 PM, Cory Zue [czue@dimagi.com](mailto:czue@dimagi.com) wrote:
> > 
> > > Hi Eric,
> > > 
> > > For normal case property you should remove the @ sign. So it should be  
> > > ce('casedb')/casedb/case[@case\_type='ANC'][@status = 'open'][Status =  
> > > 'Enrolled']
> > > 
> > > On Thu, Jan 12, 2017 at 4:21 PM, Eric Jospe [eric.jospe@gmail.com](mailto:eric.jospe@gmail.com) wrote:
> > > 
> > > > I created a form with a multiple select question with cases as options.  
> > > > On this  
> > > > [https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices](https://confluence.dimagi.com/display/commcarepublic/Multiple+Choice+Questions+with+Cases+as+Choices)  
> > > > help page, it says that you can restrict the cases shown to be only open  
> > > > cases by appending a [@status='open'] clause. I would like to further  
> > > > filter this list based on a case property (Status = 'Enrolled'). I tried  
> > > > appending this in the same way but got an error message saying it could not  
> > > > find that path. Here's the section of the XML code:
> > > > 
> > > > Is there a way to do this?
> > > > 
> > > > Thanks!
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "commcare-users" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "commcare-users" group.  
> > > To unsubscribe from this topic, visit [https://groups.google.com/d/to](https://groups.google.com/d/to)  
> > > pic/commcare-users/tQxKAmObKxA/unsubscribe.  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [commcare-users+unsubscribe@googlegroups.com](mailto:commcare-users+unsubscribe@googlegroups.com).  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
