Case List/Details Formatting

Hi CommCare Group!

We have many single select questions in our application, some with a large
number of possible choices. For each choice, there is a label (which can
contain spaces and characters) and then a choice value (which cannot
contain spaces but in our case is always exactly the same as the label with
underscores instead of spaces). The annoying part is that when this
question is stored as a case property and then displayed in the case list
(or case details), it always has the underscore. I would like to remove
this.

Clearly the case lists/details do not have a limitation on spaces because
text questions can be displayed with spaces or characters. I also know how
to use the ID mapping to map each choice onto a string. However, if we use
ID mapping we will not only have to re-type hundreds of mappings that have
already been defined elsewhere in the application, but it will also make it
harder to add choices in later versions of the application without having
to change a lot of instances of the same thing. It seems like a whole lot
of work to do when all we want is all of the underscores to be replaced by
spaces.

One solution I thought of is to copy the single select question into a
hidden value (hidden values can support spaces) and then save the hidden
value to the case rather than the single select. Unfortunately, there
don’t seem to be any functions that allow string manipulation, so this
didn’t work as I had hoped.

Any ideas/solutions? Thanks! -Jennifer

Hi Jennifer,

Sounds like you’ve really thought this through!

The way most people deal with this is kind of like what you already
mentioned, by using a hidden value and copying over single select. The
hidden value calculation would contain a series of nested ifs to map the
choice values with underscores to human readable values with spaces. This
is a little bit annoying, but works.

One alternative if you are comfortable hand-editing XML is just to work
around our restriction that choice values cannot have spaces. We disallow
spaces in our form builder because it can get people into trouble with
multiple answer questions – but spaces technically allowed in CommCare
applications. If you hand-edit the choice value in the XML to replace the
underscores with spaces, the form builder will show you a warning but will
not change the spaces back to underscores. Please only consider this option
if you are comfortable hand-editing XML and have the ability to support the
application long-term.

Thanks,
Amelia

··· On Thu, Aug 21, 2014 at 5:37 AM, wrote:

Hi CommCare Group!

We have many single select questions in our application, some with a large
number of possible choices. For each choice, there is a label (which can
contain spaces and characters) and then a choice value (which cannot
contain spaces but in our case is always exactly the same as the label with
underscores instead of spaces). The annoying part is that when this
question is stored as a case property and then displayed in the case list
(or case details), it always has the underscore. I would like to remove
this.

Clearly the case lists/details do not have a limitation on spaces because
text questions can be displayed with spaces or characters. I also know how
to use the ID mapping to map each choice onto a string. However, if we use
ID mapping we will not only have to re-type hundreds of mappings that have
already been defined elsewhere in the application, but it will also make it
harder to add choices in later versions of the application without having
to change a lot of instances of the same thing. It seems like a whole lot
of work to do when all we want is all of the underscores to be replaced by
spaces.

One solution I thought of is to copy the single select question into a
hidden value (hidden values can support spaces) and then save the hidden
value to the case rather than the single select. Unfortunately, there
don’t seem to be any functions that allow string manipulation, so this
didn’t work as I had hoped.

Any ideas/solutions? Thanks! -Jennifer


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.
For more options, visit https://groups.google.com/d/optout.