Tricky question: Outputting a field's contents in a fuller way

Hi folks -- an odd question here.

I have a "single answer" question in my form that aims which clinical
service was performed. Our main goal in collecting this is to record the
service'scode, because that code is going to be combined with other codes
to generate a full, long UIC code.

Therefore the choices that I have in that "which service was performed"
question have as their actual "choice value" a quite small code, while the
label for each of those choices provides fuller information about the real
name of that service.

(For example, one choice has its choice value as 09, but the label that's
given for that option, and its actual meaning, is "Walk-in STI."

Here is my question. At the end of this form, I have a "summary" page where
I output various information that was entered into the form. When I want to
output the choice that was made for this "service performed" question, of
course, a normal output just displays "09." What I would love is for the
app to be able to reference the meaning of that code. For example, if it
could go and reference the label that had been associated with 09, and
output that. Or, if not that, then doing some other form of "lookup" to
convert the meaning of that code, so I output something like "09 -- Walk-in
STI."

There are 12 options in that question, so a long, if, if, if, if, if, if,
if statement would not be ideal, but would that be the only method to do
this? There is not something like a "case()" statement that would consider
an array of possibilities, is there?

Thanks much!

--Eric

Eric,

Not sure what plan you're on, but it seems like this could be a good fit
for a Lookup Table in you form.

https://confluence.dimagi.com/display/commcarepublic/Creating+and+Updating+Lookup+Tables

You can create a lookup table that associates codes with a printable name,
and the lookup into that table.

-Clayton

ยทยทยท On Thu, Dec 18, 2014 at 1:45 AM, Eric Stephan wrote: > > > Hi folks -- an odd question here. > > I have a "single answer" question in my form that aims which clinical > service was performed. Our main goal in collecting this is to record the > service's*code,* because that code is going to be combined with other codes > to generate a full, long UIC code. > > Therefore the choices that I have in that "which service was performed" > question have as their actual "choice value" a quite small code, while the > label for each of those choices provides fuller information about the real > name of that service. > > (For example, one choice has its choice *value* as 09, but the label > that's given for that option, and its actual meaning, is "Walk-in STI." > > Here is my question. At the end of this form, I have a "summary" page > where I output various information that was entered into the form. When I > want to output the choice that was made for this "service performed" > question, of course, a normal output just displays "09." What I would > love is for the app to be able to reference the meaning of that code. For > example, if it could go and reference the *label* that had been associated > with 09, and output that. Or, if not that, then doing some other form of > "lookup" to convert the meaning of that code, so I output something like > "09 -- Walk-in STI." > > There are 12 options in that question, so a long, if, if, if, if, if, if, > if statement would not be ideal, but would that be the only method to do > this? There is not something like a "case()" statement that would consider > an array of possibilities, is there? > > Thanks much! > > --Eric > > -- > 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. >