# Populating multiple choice options

**URL:** <https://forum.dimagi.com/t/populating-multiple-choice-options/1390>\
**Category:** Users\
**Created:** [May 7, 2013, 7:25am UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390 "2013-05-07T07:25:59Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simone](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@Simone](https://forum.dimagi.com/u/Simone)\
**Post date:** [May 7, 2013, 7:25am UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/1 "2013-05-07T07:25:59Z")

</div>

Hello. I'm trying create a form that is able to capture details about a new  
child from a certain school. That’s is my idea for the one form and case.  
The other form is supposed to be an attendance register that is populated  
by the specific school the children are registered for, just a simple  
question with multiple checkboxes to check off whether the child is present  
or not.

My question: is it possible to populate a multiple choice question’s  
options with children/cases that have been created?

I'm not sure if I'm phrasing my question clearly enough. I'm also not sure  
how one can go about populating the multiple choice options from XML, but  
if anyone can point me in the right direction or can suggest an alternative  
way to approach the problem I'd appreciate it.

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [May 7, 2013, 3:13pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/2 "2013-05-07T15:13:12Z")

</div>

Simone,

Hi. So what you're looking to do is create a multiselect that lists cases  
to be selected? That's definitely possible in CommCare, but unfortunately  
it's not supported yet by the application builder.

I'll describe below how you can pull it off by editing the XForm by hand,  
but if that's not something your comfortable doing, we can also keep you up  
to date about when something like this is possible.

If you are comfortable hacking around in the XForm, you can set up what you  
want by setting up an "itemset" which is based on the case database.  
Essentially: You'd create a select question, edit the XML, find the  
 block which represents your placeholder question and replace its  
 tags with the following (Only the _bold_ parts of the XML below are  
changes. Everything else is what was there before). You'll need to include  
your case's "type" in the xml where noted

 \* \* \* \* \* \*\*\* \* \*

If you are not already using a form which required selecting a case, you  
will also need to add this xml right above where the app places all of the  
 tags

-Clayton

> **···**
>
> On Tue, May 7, 2013 at 3:25 AM, Simoné wrote:
> 
> > Hello. I'm trying create a form that is able to capture details about a  
> > new child from a certain school. That’s is my idea for the one form and  
> > case. The other form is supposed to be an attendance register that is  
> > populated by the specific school the children are registered for, just a  
> > simple question with multiple checkboxes to check off whether the child is  
> > present or not.
> > 
> > My question: is it possible to populate a multiple choice question’s  
> > options with children/cases that have been created?
> > 
> > I'm not sure if I'm phrasing my question clearly enough. I'm also not sure  
> > how one can go about populating the multiple choice options from XML, but  
> > if anyone can point me in the right direction or can suggest an alternative  
> > way to approach the problem I'd appreciate it.
> > 
> > --  
> > 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/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Simone](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/s/cab0a1/32.png) [@Simone](https://forum.dimagi.com/u/Simone)\
**Post date:** [July 29, 2013, 10:25am UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/3 "2013-07-29T10:25:13Z")

</div>

Hello Clayton

I've applied your suggestion and it works well to display one value per  
multi select option. I'm still not that familiar with working with the XML  
yet, but here is what I want for the option to display as well.

I want to concatenate two values together (the name and surname from each  
case) and it should only load the specific cases for a certain region. For  
that I've added a single select option before the multi select, but I'm  
unsure of how to set the condition since the values are populated through  
XML.

I'm not sure if I'm being that clear, but any help is appreciated.

> **···**
>
> On Tuesday, 7 May 2013 17:13:12 UTC+2, Clayton Sims wrote: \> \> Simone, \> \> Hi. So what you're looking to do is create a multiselect that lists cases \> to be selected? That's definitely possible in CommCare, but unfortunately \> it's not supported yet by the application builder. \> \> I'll describe below how you can pull it off by editing the XForm by hand, \> but if that's not something your comfortable doing, we can also keep you up \> to date about when something like this is possible. \> \> If you are comfortable hacking around in the XForm, you can set up what \> you want by setting up an "itemset" which is based on the case database. \> Essentially: You'd create a select question, edit the XML, find the \> block which represents your placeholder question and replace its \> tags with the following (Only the \*bold\* parts of the XML below \> are changes. Everything else is what was there before). You'll need to \> include your case's "type" in the xml where noted \> \> \> \> \* nodeset="instance('casedb')/casedb/case[@case\_type='your\_type']"\>\* \> \* \* \> \* \*\*\* \> \* \* \> \> \> If you are not already using a form which required selecting a case, you \> will also need to add this xml right above where the app places all of the \> tags \> \> \> \> \> -Clayton \> \> On Tue, May 7, 2013 at 3:25 AM, Simoné \<smhen...@gmail.com \>wrote: \> \>\> Hello. I'm trying create a form that is able to capture details about a \>\> new child from a certain school. That’s is my idea for the one form and \>\> case. The other form is supposed to be an attendance register that is \>\> populated by the specific school the children are registered for, just a \>\> simple question with multiple checkboxes to check off whether the child is \>\> present or not. \>\> \>\> My question: is it possible to populate a multiple choice question’s \>\> options with children/cases that have been created? \>\> \>\> I'm not sure if I'm phrasing my question clearly enough. I'm also not \>\> sure how one can go about populating the multiple choice options from XML, \>\> but if anyone can point me in the right direction or can suggest an \>\> alternative way to approach the problem I'd appreciate it. \>\> \>\> -- \>\> 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-user...@googlegroups.com . \>\> For more options, visit https://groups.google.com/groups/opt\_out. \>\> \>\> \>\> \> \>

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [July 29, 2013, 3:07pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/4 "2013-07-29T15:07:17Z")

</div>

Simone,

Filters are added to these expressions using the part of the expression in  
brackets (highlighted below in bold)

instance('casedb')/_casedb/case[@case\_type='your\_type']_

> **···**
>
> \* \* If you want to add additional filters (only in a certain region) you can do so by adding an additional clause with your new test (if that region is selected in the form, replace 'someregion' below with the /path/to/yourregionselect)
> 
> instance('casedb')/_casedb/case[@case\_type='your\_  
> type'][region\_variable='someregion']_
> 
> If you want to construct a string to display, you can use the "concat"  
> function as outlined at:  
> [https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-concat](https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-concat)
> 
> so something like
> 
> - 
> 
> ```
> <label ref="concat(last_name, ', ', first_name)"/>*
> 
> ```
> 
> Hope that helps, let me know if you have any other questions.
> 
> -Clayton
> 
> On Mon, Jul 29, 2013 at 6:25 AM, Simoné [smhendricks@gmail.com](mailto:smhendricks@gmail.com) wrote:
> 
> > Hello Clayton
> > 
> > I've applied your suggestion and it works well to display one value per  
> > multi select option. I'm still not that familiar with working with the XML  
> > yet, but here is what I want for the option to display as well.
> > 
> > I want to concatenate two values together (the name and surname from each  
> > case) and it should only load the specific cases for a certain region. For  
> > that I've added a single select option before the multi select, but I'm  
> > unsure of how to set the condition since the values are populated through  
> > XML.
> > 
> > I'm not sure if I'm being that clear, but any help is appreciated.
> > 
> > On Tuesday, 7 May 2013 17:13:12 UTC+2, Clayton Sims wrote:
> > 
> > > Simone,
> > > 
> > > Hi. So what you're looking to do is create a multiselect that lists cases  
> > > to be selected? That's definitely possible in CommCare, but unfortunately  
> > > it's not supported yet by the application builder.
> > > 
> > > I'll describe below how you can pull it off by editing the XForm by hand,  
> > > but if that's not something your comfortable doing, we can also keep you up  
> > > to date about when something like this is possible.
> > > 
> > > If you are comfortable hacking around in the XForm, you can set up what  
> > > you want by setting up an "itemset" which is based on the case database.  
> > > Essentially: You'd create a select question, edit the XML, find the  
> > > block which represents your placeholder question and replace its  
> > > tags with the following (Only the _bold_ parts of the XML below  
> > > are changes. Everything else is what was there before). You'll need to  
> > > include your case's "type" in the xml where noted
> > > 
> > > \* \* \* \* \* \*\*\* \* \*
> > > 
> > > If you are not already using a form which required selecting a case, you  
> > > will also need to add this xml right above where the app places all of the  
> > > tags
> > > 
> > > -Clayton
> > > 
> > > On Tue, May 7, 2013 at 3:25 AM, Simoné [smhen...@gmail.com](mailto:smhen...@gmail.com) wrote:
> > > 
> > > > Hello. I'm trying create a form that is able to capture details about a  
> > > > new child from a certain school. That’s is my idea for the one form and  
> > > > case. The other form is supposed to be an attendance register that is  
> > > > populated by the specific school the children are registered for, just a  
> > > > simple question with multiple checkboxes to check off whether the child is  
> > > > present or not.
> > > > 
> > > > My question: is it possible to populate a multiple choice question’s  
> > > > options with children/cases that have been created?
> > > > 
> > > > I'm not sure if I'm phrasing my question clearly enough. I'm also not  
> > > > sure how one can go about populating the multiple choice options from XML,  
> > > > but if anyone can point me in the right direction or can suggest an  
> > > > alternative way to approach the problem I'd appreciate it.
> > > > 
> > > > --  
> > > > 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-user...@\*\*[googlegroups.com](http://googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > > .
> > > 
> > > --  
> > > 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/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Lexa\_Koenig](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@Lexa\_Koenig](https://forum.dimagi.com/u/Lexa_Koenig)\
**Post date:** [May 19, 2016, 7:11pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/5 "2016-05-19T19:11:43Z")

</div>

Hi Clayton,

I've been attempting to achieve a similar concatenation result here, except  
with two different case properties. I've attempted the following:

But I get this error:

Errors making a new version:

- Validation Error: XPath evaluation: type mismatch  
Expected XPath path, got XPath expression: [concat(case\_name, '-',  
Vodacom\_Phone\_Number)],null in form

This is the same syntax that you've used in your last post on this thread.  
Any suggestions here?

Thanks!  
Lexa

> **···**
>
> On Monday, July 29, 2013 at 5:07:17 PM UTC+2, Clayton Sims wrote: \> \> Simone, \> \> Filters are added to these expressions using the part of the expression in \> brackets (highlighted below in bold) \> \> instance('casedb')/casedb/case\*[@case\_type='your\_type']\* \> \> If you want to add additional filters (only in a certain region) you can \> do so by adding an additional clause with your new test (if that region is \> selected in the form, replace 'someregion' below with the \> /path/to/yourregionselect) \> \> instance('casedb')/casedb/case \> \*[@case\_type='your\_type'][region\_variable='someregion']\* \> \> If you want to construct a string to display, you can use the "concat" \> function as outlined at: \> https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-concat \> \> so something like \> \> \* \* \> \> Hope that helps, let me know if you have any other questions. \> \> -Clayton \> \> On Mon, Jul 29, 2013 at 6:25 AM, Simoné \<smhen...@gmail.com \> wrote: \> \>\> Hello Clayton \>\> \>\> I've applied your suggestion and it works well to display one value per \>\> multi select option. I'm still not that familiar with working with the XML \>\> yet, but here is what I want for the option to display as well. \>\> \>\> I want to concatenate two values together (the name and surname from each \>\> case) and it should only load the specific cases for a certain region. For \>\> that I've added a single select option before the multi select, but I'm \>\> unsure of how to set the condition since the values are populated through \>\> XML. \>\> \>\> I'm not sure if I'm being that clear, but any help is appreciated. \>\> \>\> \>\> On Tuesday, 7 May 2013 17:13:12 UTC+2, Clayton Sims wrote: \>\> \>\>\> Simone, \>\>\> \>\>\> Hi. So what you're looking to do is create a multiselect that lists \>\>\> cases to be selected? That's definitely possible in CommCare, but \>\>\> unfortunately it's not supported yet by the application builder. \>\>\> \>\>\> I'll describe below how you can pull it off by editing the XForm by \>\>\> hand, but if that's not something your comfortable doing, we can also keep \>\>\> you up to date about when something like this is possible. \>\>\> \>\>\> If you are comfortable hacking around in the XForm, you can set up what \>\>\> you want by setting up an "itemset" which is based on the case database. \>\>\> Essentially: You'd create a select question, edit the XML, find the \>\>\> block which represents your placeholder question and replace its \>\>\> tags with the following (Only the \*bold\* parts of the XML below \>\>\> are changes. Everything else is what was there before). You'll need to \>\>\> include your case's "type" in the xml where noted \>\>\> \>\>\> \>\>\> \>\>\> \* \>\> nodeset="instance('casedb')/casedb/case[@case\_type='your\_type']"\>\* \>\>\> \* \* \>\>\> \*\* \>\>\> \* \* \>\>\> \>\>\> \>\>\> If you are not already using a form which required selecting a case, you \>\>\> will also need to add this xml right above where the app places all of the \>\>\> tags \>\>\> \>\>\> \>\>\> \>\>\> \>\>\> -Clayton \>\>\> \>\>\> On Tue, May 7, 2013 at 3:25 AM, Simoné wrote: \>\>\> \>\>\>\> Hello. I'm trying create a form that is able to capture details about a \>\>\>\> new child from a certain school. That’s is my idea for the one form and \>\>\>\> case. The other form is supposed to be an attendance register that is \>\>\>\> populated by the specific school the children are registered for, just a \>\>\>\> simple question with multiple checkboxes to check off whether the child is \>\>\>\> present or not. \>\>\>\> \>\>\>\> My question: is it possible to populate a multiple choice question’s \>\>\>\> options with children/cases that have been created? \>\>\>\> \>\>\>\> I'm not sure if I'm phrasing my question clearly enough. I'm also not \>\>\>\> sure how one can go about populating the multiple choice options from XML, \>\>\>\> but if anyone can point me in the right direction or can suggest an \>\>\>\> alternative way to approach the problem I'd appreciate it. \>\>\>\> \>\>\>\> -- \>\>\>\> 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-user...@googlegroups.com. \>\>\>\> \>\>\>\> For more options, visit https://groups.google.com/groups/opt\_out. \>\>\>\> \>\>\>\> \>\>\>\> \>\>\> \>\>\> -- \>\> 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-user...@googlegroups.com . \>\> For more options, visit https://groups.google.com/groups/opt\_out. \>\> \>\> \>\> \> \>

---

<div class="post-metadata">

**Author:** ![William\_Pride](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@William\_Pride](https://forum.dimagi.com/u/William_Pride)\
**Post date:** [May 20, 2016, 2:09pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/6 "2016-05-20T14:09:17Z")

</div>

Hi Lexa,

Can you confirm that Vodacom\_Phone\_Number is a case property and that if  
properly evaluated that expression will evaluate to another case property?

It can be helpful to debug statements like this with an output value  
[https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output](https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output)  
in  
a label.

Thanks,  
Will

> **···**
>
> On Thu, May 19, 2016 at 3:11 PM, wrote:
> 
> > Vodacom\_Phone\_Number

---

<div class="post-metadata">

**Author:** ![Lexa\_Koenig](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@Lexa\_Koenig](https://forum.dimagi.com/u/Lexa_Koenig)\
**Post date:** [May 26, 2016, 3:10pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/7 "2016-05-26T15:10:26Z")

</div>

Hi Will,

Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number is a  
case property. I thought that maybe because Vodacom\_Phone\_Number is a case  
property of format = Phone, that was one of the reasons it wasn't working.  
I changed it to "Plain" format, but still received the same error.

I don't understand the second part of your response: Why does the  
concatenated expression need to evaluate to another case property? I'm  
simply trying to concatenate two case properties (name + phone number) from  
a case to display as a label in a checkbox lookup table that references a  
list of cases (see below). We want the table to display name as well as  
phone to make it as easy as possible for the mobile worker to identify the  
correct participant. I'm not sure how I'll use an output value to debug the  
statement, since the form is under a module that references a different  
case\_type than the one in this list.

This is the expression that I'm working with. It displays a list of cases  
in a mutli-select list:

 \* \* \*\* \* \*

Thanks!  
Lexa

> **···**
>
> On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote: \> \> \> Hi Lexa, \> \> Can you confirm that Vodacom\_Phone\_Number is a case property and that if \> properly evaluated that expression will evaluate to another case property? \> \> It can be helpful to debug statements like this with an output value \> in \> a label. \> \> Thanks, \> Will \> \> On Thu, May 19, 2016 at 3:11 PM, \<le...@verasolutions.org \> wrote: \> \>\> Vodacom\_Phone\_Number \> \> \> \>

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [June 2, 2016, 4:13pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/8 "2016-06-02T16:13:45Z")

</div>

Hi Lexa,

I think I must have been mistaken with my original comment, apologies.

The XForm specification unfortunately does not permit an arbitrary  
expression in the "label" field, the spec is restricted to only allowing a  
path expression in that field. This is a constraint we are looking to work  
around, but haven't settled on an extension for which will let people use  
more complex expressions with itemsets, but also retain form compatibility.

-Clayton

> **···**
>
> On Thu, May 26, 2016 at 11:10 AM, wrote:
> 
> > Hi Will,
> > 
> > Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number is a  
> > case property. I thought that maybe because Vodacom\_Phone\_Number is a case  
> > property of format = Phone, that was one of the reasons it wasn't working.  
> > I changed it to "Plain" format, but still received the same error.
> > 
> > I don't understand the second part of your response: Why does the  
> > concatenated expression need to evaluate to another case property? I'm  
> > simply trying to concatenate two case properties (name + phone number) from  
> > a case to display as a label in a checkbox lookup table that references a  
> > list of cases (see below). We want the table to display name as well as  
> > phone to make it as easy as possible for the mobile worker to identify the  
> > correct participant. I'm not sure how I'll use an output value to debug the  
> > statement, since the form is under a module that references a different  
> > case\_type than the one in this list.
> > 
> > This is the expression that I'm working with. It displays a list of cases  
> > in a mutli-select list:
> > 
> > \* \* \*\* \* \*
> > 
> > Thanks!  
> > Lexa
> > 
> > On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote:
> > 
> > > Hi Lexa,
> > > 
> > > Can you confirm that Vodacom\_Phone\_Number is a case property and that if  
> > > properly evaluated that expression will evaluate to another case property?
> > > 
> > > It can be helpful to debug statements like this with an output value  
> > > [https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output](https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output) in  
> > > a label.
> > > 
> > > Thanks,  
> > > Will
> > > 
> > > On Thu, May 19, 2016 at 3:11 PM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > 
> > > > Vodacom\_Phone\_Number
> > > 
> > > --  
> > > 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:** ![Lexa\_Koenig](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@Lexa\_Koenig](https://forum.dimagi.com/u/Lexa_Koenig)\
**Post date:** [June 6, 2016, 9:53am UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/9 "2016-06-06T09:53:44Z")

</div>

Hi Clayton,

Thanks for your reply. This would be a really helpful feature, especially  
when trying to identify participants from a list who might have duplicate  
names.

As a workaround for this particular situation, if I created a hidden value  
field on the case that was a concatenation of Name and  
Vodacome\_Phone\_Number and referenced this field in the XForm, would this be  
a viable workaround?

Thanks,  
Lexa

> **···**
>
> On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote: \> \> Hi Lexa, \> \> I think I must have been mistaken with my original comment, apologies. \> \> The XForm specification unfortunately does not permit an arbitrary \> expression in the "label" field, the spec is restricted to only allowing a \> path expression in that field. This is a constraint we are looking to work \> around, but haven't settled on an extension for which will let people use \> more complex expressions with itemsets, but also retain form compatibility. \> \> -Clayton \> \> On Thu, May 26, 2016 at 11:10 AM, \<le...@verasolutions.org \> wrote: \> \>\> Hi Will, \>\> \>\> Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number is a \>\> case property. I thought that maybe because Vodacom\_Phone\_Number is a case \>\> property of format = Phone, that was one of the reasons it wasn't working. \>\> I changed it to "Plain" format, but still received the same error. \>\> \>\> I don't understand the second part of your response: Why does the \>\> concatenated expression need to evaluate to another case property? I'm \>\> simply trying to concatenate two case properties (name + phone number) from \>\> a case to display as a label in a checkbox lookup table that references a \>\> list of cases (see below). We want the table to display name as well as \>\> phone to make it as easy as possible for the mobile worker to identify the \>\> correct participant. I'm not sure how I'll use an output value to debug the \>\> statement, since the form is under a module that references a different \>\> case\_type than the one in this list. \>\> \>\> This is the expression that I'm working with. It displays a list of cases \>\> in a mutli-select list: \>\> \>\> \>\> \>\> \* \> nodeset="instance('casedb')/casedb/case[@case\_type='Participant']"\>\* \>\> \>\> \*\* \>\> \* \* \>\> \>\> \>\> Thanks! \>\> Lexa \>\> \>\> On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote: \>\>\> \>\>\> \>\>\> Hi Lexa, \>\>\> \>\>\> Can you confirm that Vodacom\_Phone\_Number is a case property and that if \>\>\> properly evaluated that expression will evaluate to another case property? \>\>\> \>\>\> It can be helpful to debug statements like this with an output value \>\>\> in \>\>\> a label. \>\>\> \>\>\> Thanks, \>\>\> Will \>\>\> \>\>\> On Thu, May 19, 2016 at 3:11 PM, wrote: \>\>\> \>\>\>\> Vodacom\_Phone\_Number \>\>\> \>\>\> \>\>\> \>\>\> -- \>\> 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-user...@googlegroups.com . \>\> For more options, visit https://groups.google.com/d/optout. \>\> \> \>

---

<div class="post-metadata">

**Author:** ![William\_Pride](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/w/b19c9b/32.png) [@William\_Pride](https://forum.dimagi.com/u/William_Pride)\
**Post date:** [June 6, 2016, 1:29pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/10 "2016-06-06T13:29:22Z")

</div>

Hi Lexa,

Yes, saving the concatenated fields as a case property and referencing this  
would work correctly.

Best,  
Will

> **···**
>
> On Mon, Jun 6, 2016 at 5:53 AM, wrote:
> 
> > Hi Clayton,
> > 
> > Thanks for your reply. This would be a really helpful feature, especially  
> > when trying to identify participants from a list who might have duplicate  
> > names.
> > 
> > As a workaround for this particular situation, if I created a hidden value  
> > field on the case that was a concatenation of Name and  
> > Vodacome\_Phone\_Number and referenced this field in the XForm, would this be  
> > a viable workaround?
> > 
> > Thanks,  
> > Lexa
> > 
> > On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote:
> > 
> > > Hi Lexa,
> > > 
> > > I think I must have been mistaken with my original comment, apologies.
> > > 
> > > The XForm specification unfortunately does not permit an arbitrary  
> > > expression in the "label" field, the spec is restricted to only allowing a  
> > > path expression in that field. This is a constraint we are looking to work  
> > > around, but haven't settled on an extension for which will let people use  
> > > more complex expressions with itemsets, but also retain form compatibility.
> > > 
> > > -Clayton
> > > 
> > > On Thu, May 26, 2016 at 11:10 AM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > 
> > > > Hi Will,
> > > > 
> > > > Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number is  
> > > > a case property. I thought that maybe because Vodacom\_Phone\_Number is a  
> > > > case property of format = Phone, that was one of the reasons it wasn't  
> > > > working. I changed it to "Plain" format, but still received the same error.
> > > > 
> > > > I don't understand the second part of your response: Why does the  
> > > > concatenated expression need to evaluate to another case property? I'm  
> > > > simply trying to concatenate two case properties (name + phone number) from  
> > > > a case to display as a label in a checkbox lookup table that references a  
> > > > list of cases (see below). We want the table to display name as well as  
> > > > phone to make it as easy as possible for the mobile worker to identify the  
> > > > correct participant. I'm not sure how I'll use an output value to debug the  
> > > > statement, since the form is under a module that references a different  
> > > > case\_type than the one in this list.
> > > > 
> > > > This is the expression that I'm working with. It displays a list of  
> > > > cases in a mutli-select list:
> > > > 
> > > > \* \* \*\* \* \*
> > > > 
> > > > Thanks!  
> > > > Lexa
> > > > 
> > > > On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote:
> > > > 
> > > > > Hi Lexa,
> > > > > 
> > > > > Can you confirm that Vodacom\_Phone\_Number is a case property and that  
> > > > > if properly evaluated that expression will evaluate to another case  
> > > > > property?
> > > > > 
> > > > > It can be helpful to debug statements like this with an output value  
> > > > > [https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output](https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output) in  
> > > > > a label.
> > > > > 
> > > > > Thanks,  
> > > > > Will
> > > > > 
> > > > > On Thu, May 19, 2016 at 3:11 PM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > > > 
> > > > > > Vodacom\_Phone\_Number
> > > > > 
> > > > > --  
> > > > > 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-user...@googlegroups.com](mailto:commcare-user...@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 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:** ![Lexa\_Koenig](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/l/ec9cab/32.png) [@Lexa\_Koenig](https://forum.dimagi.com/u/Lexa_Koenig)\
**Post date:** [June 15, 2016, 11:07am UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/11 "2016-06-15T11:07:14Z")

</div>

Hi all,

Another question regarding the feature of populating multiple choice  
questions with cases as choices. Is it possible to sort the values that  
populate? Right now, all the values seem to appear in the order that the  
cases were created. Is there a way to customize the sorting? Ideally we  
want the names of cases to be sorted alphabetically.

Thanks!  
Lexa

> **···**
>
> On Monday, June 6, 2016 at 3:29:24 PM UTC+2, William Pride wrote: \> \> Hi Lexa, \> \> Yes, saving the concatenated fields as a case property and referencing \> this would work correctly. \> \> Best, \> Will \> \> On Mon, Jun 6, 2016 at 5:53 AM, \<le...@verasolutions.org \> wrote: \> \>\> Hi Clayton, \>\> \>\> Thanks for your reply. This would be a really helpful feature, especially \>\> when trying to identify participants from a list who might have duplicate \>\> names. \>\> \>\> As a workaround for this particular situation, if I created a hidden \>\> value field on the case that was a concatenation of Name and \>\> Vodacome\_Phone\_Number and referenced this field in the XForm, would this be \>\> a viable workaround? \>\> \>\> Thanks, \>\> Lexa \>\> \>\> On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote: \>\>\> \>\>\> Hi Lexa, \>\>\> \>\>\> I think I must have been mistaken with my original comment, apologies. \>\>\> \>\>\> The XForm specification unfortunately does not permit an arbitrary \>\>\> expression in the "label" field, the spec is restricted to only allowing a \>\>\> path expression in that field. This is a constraint we are looking to work \>\>\> around, but haven't settled on an extension for which will let people use \>\>\> more complex expressions with itemsets, but also retain form compatibility. \>\>\> \>\>\> -Clayton \>\>\> \>\>\> On Thu, May 26, 2016 at 11:10 AM, wrote: \>\>\> \>\>\>\> Hi Will, \>\>\>\> \>\>\>\> Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number is \>\>\>\> a case property. I thought that maybe because Vodacom\_Phone\_Number is a \>\>\>\> case property of format = Phone, that was one of the reasons it wasn't \>\>\>\> working. I changed it to "Plain" format, but still received the same error. \>\>\>\> \>\>\>\> I don't understand the second part of your response: Why does the \>\>\>\> concatenated expression need to evaluate to another case property? I'm \>\>\>\> simply trying to concatenate two case properties (name + phone number) from \>\>\>\> a case to display as a label in a checkbox lookup table that references a \>\>\>\> list of cases (see below). We want the table to display name as well as \>\>\>\> phone to make it as easy as possible for the mobile worker to identify the \>\>\>\> correct participant. I'm not sure how I'll use an output value to debug the \>\>\>\> statement, since the form is under a module that references a different \>\>\>\> case\_type than the one in this list. \>\>\>\> \>\>\>\> This is the expression that I'm working with. It displays a list of \>\>\>\> cases in a mutli-select list: \>\>\>\> \>\>\>\> \>\>\>\> \>\>\>\> \* \>\>\> nodeset="instance('casedb')/casedb/case[@case\_type='Participant']"\>\* \>\>\>\> \>\>\>\> \*\* \>\>\>\> \* \* \>\>\>\> \>\>\>\> \>\>\>\> Thanks! \>\>\>\> Lexa \>\>\>\> \>\>\>\> On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote: \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> Hi Lexa, \>\>\>\>\> \>\>\>\>\> Can you confirm that Vodacom\_Phone\_Number is a case property and that \>\>\>\>\> if properly evaluated that expression will evaluate to another case \>\>\>\>\> property? \>\>\>\>\> \>\>\>\>\> It can be helpful to debug statements like this with an output value \>\>\>\>\> in \>\>\>\>\> a label. \>\>\>\>\> \>\>\>\>\> Thanks, \>\>\>\>\> Will \>\>\>\>\> \>\>\>\>\> On Thu, May 19, 2016 at 3:11 PM, wrote: \>\>\>\>\> \>\>\>\>\>\> Vodacom\_Phone\_Number \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> -- \>\>\>\> 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-user...@googlegroups.com. \>\>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\>\> \>\>\> \>\>\> -- \>\> 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-user...@googlegroups.com . \>\> For more options, visit https://groups.google.com/d/optout. \>\> \> \>

---

<div class="post-metadata">

**Author:** ![Jesse\_Twum-Boafo](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/85e7bf/32.png) [@Jesse\_Twum-Boafo](https://forum.dimagi.com/u/Jesse_Twum-Boafo)\
**Post date:** [July 25, 2016, 12:07pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/12 "2016-07-25T12:07:03Z")

</div>

Hi William and Clayton,

I wanted to nudge on Lexa's question. Is it possible in any way to sort the  
case\_ids in the lookup table?

Thanks,  
Jesse

> **···**
>
> On Wednesday, June 15, 2016 at 1:07:15 PM UTC+2, le...@verasolutions.org wrote: \> \> Hi all, \> \> Another question regarding the feature of populating multiple choice \> questions with cases as choices. Is it possible to sort the values that \> populate? Right now, all the values seem to appear in the order that the \> cases were created. Is there a way to customize the sorting? Ideally we \> want the names of cases to be sorted alphabetically. \> \> Thanks! \> Lexa \> \> On Monday, June 6, 2016 at 3:29:24 PM UTC+2, William Pride wrote: \>\> \>\> Hi Lexa, \>\> \>\> Yes, saving the concatenated fields as a case property and referencing \>\> this would work correctly. \>\> \>\> Best, \>\> Will \>\> \>\> On Mon, Jun 6, 2016 at 5:53 AM, wrote: \>\> \>\>\> Hi Clayton, \>\>\> \>\>\> Thanks for your reply. This would be a really helpful feature, \>\>\> especially when trying to identify participants from a list who might have \>\>\> duplicate names. \>\>\> \>\>\> As a workaround for this particular situation, if I created a hidden \>\>\> value field on the case that was a concatenation of Name and \>\>\> Vodacome\_Phone\_Number and referenced this field in the XForm, would this be \>\>\> a viable workaround? \>\>\> \>\>\> Thanks, \>\>\> Lexa \>\>\> \>\>\> On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote: \>\>\>\> \>\>\>\> Hi Lexa, \>\>\>\> \>\>\>\> I think I must have been mistaken with my original comment, apologies. \>\>\>\> \>\>\>\> The XForm specification unfortunately does not permit an arbitrary \>\>\>\> expression in the "label" field, the spec is restricted to only allowing a \>\>\>\> path expression in that field. This is a constraint we are looking to work \>\>\>\> around, but haven't settled on an extension for which will let people use \>\>\>\> more complex expressions with itemsets, but also retain form compatibility. \>\>\>\> \>\>\>\> -Clayton \>\>\>\> \>\>\>\> On Thu, May 26, 2016 at 11:10 AM, wrote: \>\>\>\> \>\>\>\>\> Hi Will, \>\>\>\>\> \>\>\>\>\> Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number \>\>\>\>\> is a case property. I thought that maybe because Vodacom\_Phone\_Number is a \>\>\>\>\> case property of format = Phone, that was one of the reasons it wasn't \>\>\>\>\> working. I changed it to "Plain" format, but still received the same error. \>\>\>\>\> \>\>\>\>\> I don't understand the second part of your response: Why does the \>\>\>\>\> concatenated expression need to evaluate to another case property? I'm \>\>\>\>\> simply trying to concatenate two case properties (name + phone number) from \>\>\>\>\> a case to display as a label in a checkbox lookup table that references a \>\>\>\>\> list of cases (see below). We want the table to display name as well as \>\>\>\>\> phone to make it as easy as possible for the mobile worker to identify the \>\>\>\>\> correct participant. I'm not sure how I'll use an output value to debug the \>\>\>\>\> statement, since the form is under a module that references a different \>\>\>\>\> case\_type than the one in this list. \>\>\>\>\> \>\>\>\>\> This is the expression that I'm working with. It displays a list of \>\>\>\>\> cases in a mutli-select list: \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> \* \>\>\>\> nodeset="instance('casedb')/casedb/case[@case\_type='Participant']"\>\* \>\>\>\>\> \>\>\>\>\> \*\* \>\>\>\>\> \* \* \>\>\>\>\> \>\>\>\>\> \>\>\>\>\> Thanks! \>\>\>\>\> Lexa \>\>\>\>\> \>\>\>\>\> On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote: \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> Hi Lexa, \>\>\>\>\>\> \>\>\>\>\>\> Can you confirm that Vodacom\_Phone\_Number is a case property and that \>\>\>\>\>\> if properly evaluated that expression will evaluate to another case \>\>\>\>\>\> property? \>\>\>\>\>\> \>\>\>\>\>\> It can be helpful to debug statements like this with an output value \>\>\>\>\>\> in \>\>\>\>\>\> a label. \>\>\>\>\>\> \>\>\>\>\>\> Thanks, \>\>\>\>\>\> Will \>\>\>\>\>\> \>\>\>\>\>\> On Thu, May 19, 2016 at 3:11 PM, wrote: \>\>\>\>\>\> \>\>\>\>\>\>\> Vodacom\_Phone\_Number \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> -- \>\>\>\>\> 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-user...@googlegroups.com. \>\>\>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\>\>\> \>\>\>\> \>\>\>\> -- \>\>\> 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-user...@googlegroups.com. \>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\> \>\> \>\>

---

<div class="post-metadata">

**Author:** ![Jesse\_Twum-Boafo](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/j/85e7bf/32.png) [@Jesse\_Twum-Boafo](https://forum.dimagi.com/u/Jesse_Twum-Boafo)\
**Post date:** [July 25, 2016, 12:13pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/13 "2016-07-25T12:13:56Z")

</div>

I've just seen here  
[https://groups.google.com/forum/#!topic/commcare-users/fdW5nV4xYwo](https://groups.google.com/forum/#!topic/commcare-users/fdW5nV4xYwo) that  
it isn't possible. Is there a particular order that it's populating in by  
default?

> **···**
>
> On Monday, July 25, 2016 at 2:07:04 PM UTC+2, Jesse Twum-Boafo wrote: \> \> Hi William and Clayton, \> \> I wanted to nudge on Lexa's question. Is it possible in any way to sort \> the case\_ids in the lookup table? \> \> Thanks, \> Jesse \> \> On Wednesday, June 15, 2016 at 1:07:15 PM UTC+2, le...@verasolutions.org wrote: \>\> \>\> Hi all, \>\> \>\> Another question regarding the feature of populating multiple choice \>\> questions with cases as choices. Is it possible to sort the values that \>\> populate? Right now, all the values seem to appear in the order that the \>\> cases were created. Is there a way to customize the sorting? Ideally we \>\> want the names of cases to be sorted alphabetically. \>\> \>\> Thanks! \>\> Lexa \>\> \>\> On Monday, June 6, 2016 at 3:29:24 PM UTC+2, William Pride wrote: \>\>\> \>\>\> Hi Lexa, \>\>\> \>\>\> Yes, saving the concatenated fields as a case property and referencing \>\>\> this would work correctly. \>\>\> \>\>\> Best, \>\>\> Will \>\>\> \>\>\> On Mon, Jun 6, 2016 at 5:53 AM, wrote: \>\>\> \>\>\>\> Hi Clayton, \>\>\>\> \>\>\>\> Thanks for your reply. This would be a really helpful feature, \>\>\>\> especially when trying to identify participants from a list who might have \>\>\>\> duplicate names. \>\>\>\> \>\>\>\> As a workaround for this particular situation, if I created a hidden \>\>\>\> value field on the case that was a concatenation of Name and \>\>\>\> Vodacome\_Phone\_Number and referenced this field in the XForm, would this be \>\>\>\> a viable workaround? \>\>\>\> \>\>\>\> Thanks, \>\>\>\> Lexa \>\>\>\> \>\>\>\> On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote: \>\>\>\>\> \>\>\>\>\> Hi Lexa, \>\>\>\>\> \>\>\>\>\> I think I must have been mistaken with my original comment, apologies. \>\>\>\>\> \>\>\>\>\> The XForm specification unfortunately does not permit an arbitrary \>\>\>\>\> expression in the "label" field, the spec is restricted to only allowing a \>\>\>\>\> path expression in that field. This is a constraint we are looking to work \>\>\>\>\> around, but haven't settled on an extension for which will let people use \>\>\>\>\> more complex expressions with itemsets, but also retain form compatibility. \>\>\>\>\> \>\>\>\>\> -Clayton \>\>\>\>\> \>\>\>\>\> On Thu, May 26, 2016 at 11:10 AM, wrote: \>\>\>\>\> \>\>\>\>\>\> Hi Will, \>\>\>\>\>\> \>\>\>\>\>\> Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number \>\>\>\>\>\> is a case property. I thought that maybe because Vodacom\_Phone\_Number is a \>\>\>\>\>\> case property of format = Phone, that was one of the reasons it wasn't \>\>\>\>\>\> working. I changed it to "Plain" format, but still received the same error. \>\>\>\>\>\> \>\>\>\>\>\> I don't understand the second part of your response: Why does the \>\>\>\>\>\> concatenated expression need to evaluate to another case property? I'm \>\>\>\>\>\> simply trying to concatenate two case properties (name + phone number) from \>\>\>\>\>\> a case to display as a label in a checkbox lookup table that references a \>\>\>\>\>\> list of cases (see below). We want the table to display name as well as \>\>\>\>\>\> phone to make it as easy as possible for the mobile worker to identify the \>\>\>\>\>\> correct participant. I'm not sure how I'll use an output value to debug the \>\>\>\>\>\> statement, since the form is under a module that references a different \>\>\>\>\>\> case\_type than the one in this list. \>\>\>\>\>\> \>\>\>\>\>\> This is the expression that I'm working with. It displays a list of \>\>\>\>\>\> cases in a mutli-select list: \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> \* \>\>\>\>\> nodeset="instance('casedb')/casedb/case[@case\_type='Participant']"\>\* \>\>\>\>\>\> \>\>\>\>\>\> \*\* \>\>\>\>\>\> \* \* \>\>\>\>\>\> \>\>\>\>\>\> \>\>\>\>\>\> Thanks! \>\>\>\>\>\> Lexa \>\>\>\>\>\> \>\>\>\>\>\> On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote: \>\>\>\>\>\>\> \>\>\>\>\>\>\> \>\>\>\>\>\>\> Hi Lexa, \>\>\>\>\>\>\> \>\>\>\>\>\>\> Can you confirm that Vodacom\_Phone\_Number is a case property and \>\>\>\>\>\>\> that if properly evaluated that expression will evaluate to another case \>\>\>\>\>\>\> property? \>\>\>\>\>\>\> \>\>\>\>\>\>\> It can be helpful to debug statements like this with an output value \>\>\>\>\>\>\> in \>\>\>\>\>\>\> a label. \>\>\>\>\>\>\> \>\>\>\>\>\>\> Thanks, \>\>\>\>\>\>\> Will \>\>\>\>\>\>\> \>\>\>\>\>\>\> On Thu, May 19, 2016 at 3:11 PM, wrote: \>\>\>\>\>\>\> \>\>\>\>\>\>\>\> Vodacom\_Phone\_Number \>\>\>\>\>\>\> \>\>\>\>\>\>\> \>\>\>\>\>\>\> \>\>\>\>\>\>\> -- \>\>\>\>\>\> 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-user...@googlegroups.com. \>\>\>\>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\>\>\>\> \>\>\>\>\> \>\>\>\>\> -- \>\>\>\> 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-user...@googlegroups.com. \>\>\>\> For more options, visit https://groups.google.com/d/optout. \>\>\>\> \>\>\> \>\>\>

---

<div class="post-metadata">

**Author:** ![Clayton\_Sims](https://dimagi.b-cdn.net/user_avatar/forum.dimagi.com/clayton_sims/32/496_2.png) [@Clayton\_Sims](https://forum.dimagi.com/u/Clayton_Sims)\
**Post date:** [July 25, 2016, 1:35pm UTC](https://forum.dimagi.com/t/populating-multiple-choice-options/1390/14 "2016-07-25T13:35:12Z")

</div>

Jesse,

I believe it's not intentional or well-defined, but I think the default  
would be to return the records in the order that they come out of the  
database, which in this case would be roughly correlated with when the  
cases are created the first time and have an ID assigned.

-Clayton

> **···**
>
> On Mon, Jul 25, 2016 at 8:13 AM, Jesse Twum-Boafo wrote:
> 
> > I've just seen here  
> > [https://groups.google.com/forum/#!topic/commcare-users/fdW5nV4xYwo](https://groups.google.com/forum/#!topic/commcare-users/fdW5nV4xYwo) that  
> > it isn't possible. Is there a particular order that it's populating in by  
> > default?
> > 
> > On Monday, July 25, 2016 at 2:07:04 PM UTC+2, Jesse Twum-Boafo wrote:
> > 
> > > Hi William and Clayton,
> > > 
> > > I wanted to nudge on Lexa's question. Is it possible in any way to sort  
> > > the case\_ids in the lookup table?
> > > 
> > > Thanks,  
> > > Jesse
> > > 
> > > On Wednesday, June 15, 2016 at 1:07:15 PM UTC+2, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > Another question regarding the feature of populating multiple choice  
> > > > questions with cases as choices. Is it possible to sort the values that  
> > > > populate? Right now, all the values seem to appear in the order that the  
> > > > cases were created. Is there a way to customize the sorting? Ideally we  
> > > > want the names of cases to be sorted alphabetically.
> > > > 
> > > > Thanks!  
> > > > Lexa
> > > > 
> > > > On Monday, June 6, 2016 at 3:29:24 PM UTC+2, William Pride wrote:
> > > > 
> > > > > Hi Lexa,
> > > > > 
> > > > > Yes, saving the concatenated fields as a case property and referencing  
> > > > > this would work correctly.
> > > > > 
> > > > > Best,  
> > > > > Will
> > > > > 
> > > > > On Mon, Jun 6, 2016 at 5:53 AM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > > > 
> > > > > > Hi Clayton,
> > > > > > 
> > > > > > Thanks for your reply. This would be a really helpful feature,  
> > > > > > especially when trying to identify participants from a list who might have  
> > > > > > duplicate names.
> > > > > > 
> > > > > > As a workaround for this particular situation, if I created a hidden  
> > > > > > value field on the case that was a concatenation of Name and  
> > > > > > Vodacome\_Phone\_Number and referenced this field in the XForm, would this be  
> > > > > > a viable workaround?
> > > > > > 
> > > > > > Thanks,  
> > > > > > Lexa
> > > > > > 
> > > > > > On Thursday, June 2, 2016 at 6:14:06 PM UTC+2, Clayton Sims wrote:
> > > > > > 
> > > > > > > Hi Lexa,
> > > > > > > 
> > > > > > > I think I must have been mistaken with my original comment, apologies.
> > > > > > > 
> > > > > > > The XForm specification unfortunately does not permit an arbitrary  
> > > > > > > expression in the "label" field, the spec is restricted to only allowing a  
> > > > > > > path expression in that field. This is a constraint we are looking to work  
> > > > > > > around, but haven't settled on an extension for which will let people use  
> > > > > > > more complex expressions with itemsets, but also retain form compatibility.
> > > > > > > 
> > > > > > > -Clayton
> > > > > > > 
> > > > > > > On Thu, May 26, 2016 at 11:10 AM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > > > > > 
> > > > > > > > Hi Will,
> > > > > > > > 
> > > > > > > > Thanks for your reply, Will. I can confirm that Vodacom\_Phone\_Number  
> > > > > > > > is a case property. I thought that maybe because Vodacom\_Phone\_Number is a  
> > > > > > > > case property of format = Phone, that was one of the reasons it wasn't  
> > > > > > > > working. I changed it to "Plain" format, but still received the same error.
> > > > > > > > 
> > > > > > > > I don't understand the second part of your response: Why does the  
> > > > > > > > concatenated expression need to evaluate to another case property? I'm  
> > > > > > > > simply trying to concatenate two case properties (name + phone number) from  
> > > > > > > > a case to display as a label in a checkbox lookup table that references a  
> > > > > > > > list of cases (see below). We want the table to display name as well as  
> > > > > > > > phone to make it as easy as possible for the mobile worker to identify the  
> > > > > > > > correct participant. I'm not sure how I'll use an output value to debug the  
> > > > > > > > statement, since the form is under a module that references a different  
> > > > > > > > case\_type than the one in this list.
> > > > > > > > 
> > > > > > > > This is the expression that I'm working with. It displays a list of  
> > > > > > > > cases in a mutli-select list:
> > > > > > > > 
> > > > > > > > \* \* \*\* \* \*
> > > > > > > > 
> > > > > > > > Thanks!  
> > > > > > > > Lexa
> > > > > > > > 
> > > > > > > > On Friday, May 20, 2016 at 4:09:19 PM UTC+2, William Pride wrote:
> > > > > > > > 
> > > > > > > > > Hi Lexa,
> > > > > > > > > 
> > > > > > > > > Can you confirm that Vodacom\_Phone\_Number is a case property and  
> > > > > > > > > that if properly evaluated that expression will evaluate to another case  
> > > > > > > > > property?
> > > > > > > > > 
> > > > > > > > > It can be helpful to debug statements like this with an output  
> > > > > > > > > value  
> > > > > > > > > [https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output](https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+4%3A+Displaying+an+Output) in  
> > > > > > > > > a label.
> > > > > > > > > 
> > > > > > > > > Thanks,  
> > > > > > > > > Will
> > > > > > > > > 
> > > > > > > > > On Thu, May 19, 2016 at 3:11 PM, [le...@verasolutions.org](mailto:le...@verasolutions.org) wrote:
> > > > > > > > > 
> > > > > > > > > > Vodacom\_Phone\_Number
> > > > > > > > > 
> > > > > > > > > --  
> > > > > > > > > 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-user...@googlegroups.com](mailto:commcare-user...@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 the Google  
> > > > > > > Groups "commcare-users" group.  
> > > > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > > > an email to [commcare-user...@googlegroups.com](mailto:commcare-user...@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 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).
