Displaying labels rather then values of previous answers

Hi All,

I feel like there is a very simple answer to what I need to do, but for some reason I'm not able to see it.

Basically I have a question that references the respondent's answer to a previous question. Easy enough, except that if I use ${prev_question} in the new question's label, the value of the previous question's answer is displayed not the label of the answer (multiple choice question).

e.g.

Previous question: what age bracket are you?
answers:
(in excel "choices" sheet)
name label
(1) 10-20
(2) 20-30, etc
(3) ...
Next question: How responsible do you think people in the {age bracket label} bracket are?

right now when i use ${prev_question} the name value pops into the question rather then the label.

cheers!
Martha

Hi Martha,

Use jr:choice-name() to show the label instead of value.

http://opendatakit.org/help/form-design/binding has more details and
https://groups.google.com/d/msg/opendatakit/gRdvgUR7mfA/WHHi9XJpzckJ
has an example with a workaround for a common gotcha.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Sat, Jan 18, 2014 at 5:04 AM, m.ross31@gmail.com wrote:

Hi All,

I feel like there is a very simple answer to what I need to do, but for some reason I'm not able to see it.

Basically I have a question that references the respondent's answer to a previous question. Easy enough, except that if I use ${prev_question} in the new question's label, the value of the previous question's answer is displayed not the label of the answer (multiple choice question).

e.g.

Previous question: what age bracket are you?
answers:
(in excel "choices" sheet)
name label
(1) 10-20
(2) 20-30, etc
(3) ...
Next question: How responsible do you think people in the {age bracket label} bracket are?

right now when i use ${prev_question} the name value pops into the question rather then the label.

cheers!
Martha

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Yaw,

Thanks for the advice! I tried it out, and the form published fine but when I went through to test it when I tried to swipe past the question with the jr:choice-name command ODK crashed.

I've attached an excerpt file from my main file with the relevant questions. You'll see that I ask employment and then reference this in two later questions (lines 14 and 26)

What have I done wrong?
Cheers,
Martha

samplexlsform.xlsx (11.5 KB)

Martha, you missed a "$":

if( string-length(${employment}) != 0, jr:choice-name (${employment},
'${employment}' ), 'unspecified')

··· On Tuesday, January 21, 2014, wrote:

Hi Yaw,

Thanks for the advice! I tried it out, and the form published fine but
when I went through to test it when I tried to swipe past the question with
the jr:choice-name command ODK crashed.

I've attached an excerpt file from my main file with the relevant
questions. You'll see that I ask employment and then reference this in two
later questions (lines 14 and 26)

What have I done wrong?
Cheers,
Martha

--

Post: opendatakit@googlegroups.com <javascript:;>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:;>
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com <javascript:;>.
For more options, visit https://groups.google.com/groups/opt_out.

--

Nik
Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop
me an email.

Ooops! Fixed that, and now it loads and doesn't crash....but nothing shows up when I later reference my calculate line with the jr:choice-name calculation.

argh!

Martha

samplexlsform.xlsx (10.2 KB)

··· On Tuesday, January 21, 2014 2:38:44 PM UTC+1, ニコノコ wrote: > Martha, you missed a "$": > > if( string-length(${employment}) != 0, jr:choice-name (${employment}, '${employment}' ), 'unspecified') > > > > > On Tuesday, January 21, 2014, wrote: > > Hi Yaw, > > > > Thanks for the advice! I tried it out, and the form published fine but when I went through to test it when I tried to swipe past the question with the jr:choice-name command ODK crashed. > > > > I've attached an excerpt file from my main file with the relevant questions. You'll see that I ask employment and then reference this in two later questions (lines 14 and 26) > > > > What have I done wrong? > > Cheers, > > Martha > > > > -- > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > > -- > Nik > Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop me an email.

It seems to work just fine on ODK Collect 1.4. What does your choices sheet
look like?

··· On Wednesday, January 22, 2014, wrote:

Ooops! Fixed that, and now it loads and doesn't crash....but nothing shows
up when I later reference my calculate line with the jr:choice-name
calculation.

argh!

Martha

On Tuesday, January 21, 2014 2:38:44 PM UTC+1, ニコノコ wrote:

Martha, you missed a "$":

if( string-length(${employment}) != 0, jr:choice-name (${employment},
'${employment}' ), 'unspecified')

On Tuesday, January 21, 2014, <m.ro...@gmail.com <javascript:;>> wrote:

Hi Yaw,

Thanks for the advice! I tried it out, and the form published fine but
when I went through to test it when I tried to swipe past the question with
the jr:choice-name command ODK crashed.

I've attached an excerpt file from my main file with the relevant
questions. You'll see that I ask employment and then reference this in two
later questions (lines 14 and 26)

What have I done wrong?

Cheers,

Martha

--

--

Post: opendatakit@googlegroups.com <javascript:;>

Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:;>

Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google
Groups "ODK Community" group.

To unsubscribe from this group and stop receiving emails from it, send
an email to opendatakit+unsubscribe@googlegroups.com <javascript:;>.

For more options, visit https://groups.google.com/groups/opt_out.

--

--
Nik
Need help customizing Survey Instruments/Tools/Forms for ODK Collect?
Drop me an email.

--

Post: opendatakit@googlegroups.com <javascript:;>
Unsubscribe: opendatakit+unsubscribe@googlegroups.com <javascript:;>
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com <javascript:;>.
For more options, visit https://groups.google.com/groups/opt_out.

--

Nik
Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop
me an email.

choices sheet attached (of course in my actual file i have the sheets labeled properly survey and choices). I have the most recent ODK Collect so I'm thinking there's something not right in my code.

Hmm, will continue to play around with it.

Thanks for the help!
Martha

samplexlsform.xlsx (8.97 KB)

··· On Wednesday, January 22, 2014 2:28:33 AM UTC+1, ニコノコ wrote: > It seems to work just fine on ODK Collect 1.4. What does your choices sheet look like? > > On Wednesday, January 22, 2014, wrote: > > Ooops! Fixed that, and now it loads and doesn't crash....but nothing shows up when I later reference my calculate line with the jr:choice-name calculation. > > > > argh! > > > > Martha > > > > > > > > > > On Tuesday, January 21, 2014 2:38:44 PM UTC+1, ニコノコ wrote: > > > Martha, you missed a "$": > > > > > > if( string-length(${employment}) != 0, jr:choice-name (${employment}, '${employment}' ), 'unspecified') > > > > > > > > > > > > > > > On Tuesday, January 21, 2014, wrote: > > > > > > Hi Yaw, > > > > > > > > > > > > Thanks for the advice! I tried it out, and the form published fine but when I went through to test it when I tried to swipe past the question with the jr:choice-name command ODK crashed. > > > > > > > > > > > > I've attached an excerpt file from my main file with the relevant questions. You'll see that I ask employment and then reference this in two later questions (lines 14 and 26) > > > > > > > > > > > > What have I done wrong? > > > > > > Cheers, > > > > > > Martha > > > > > > > > > > > > -- > > > > > > -- > > > > > > Post: opendatakit@googlegroups.com > > > > > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > > > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > > > > > > > --- > > > > > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > > > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > -- > > > > > > -- > > > Nik > > > Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop me an email. > > > > -- > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > --- > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > > -- > Nik > Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop me an email.

Figured it out -- of course of 30+ tablets I was testing the forms on the only one that didn't have ODK updated.

everything works! Thanks!

··· On Wednesday, January 22, 2014 10:14:38 AM UTC+1, m.ro...@gmail.com wrote: > choices sheet attached (of course in my actual file i have the sheets labeled properly survey and choices). I have the most recent ODK Collect so I'm thinking there's something not right in my code. > > > > Hmm, will continue to play around with it. > > > > Thanks for the help! > > Martha > > > > On Wednesday, January 22, 2014 2:28:33 AM UTC+1, ニコノコ wrote: > > > It seems to work just fine on ODK Collect 1.4. What does your choices sheet look like? > > > > > > On Wednesday, January 22, 2014, wrote: > > > > > > Ooops! Fixed that, and now it loads and doesn't crash....but nothing shows up when I later reference my calculate line with the jr:choice-name calculation. > > > > > > > > > > > > argh! > > > > > > > > > > > > Martha > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Tuesday, January 21, 2014 2:38:44 PM UTC+1, ニコノコ wrote: > > > > > > > Martha, you missed a "$": > > > > > > > > > > > > > > if( string-length(${employment}) != 0, jr:choice-name (${employment}, '${employment}' ), 'unspecified') > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Tuesday, January 21, 2014, wrote: > > > > > > > > > > > > > > Hi Yaw, > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks for the advice! I tried it out, and the form published fine but when I went through to test it when I tried to swipe past the question with the jr:choice-name command ODK crashed. > > > > > > > > > > > > > > > > > > > > > > > > > > > > I've attached an excerpt file from my main file with the relevant questions. You'll see that I ask employment and then reference this in two later questions (lines 14 and 26) > > > > > > > > > > > > > > > > > > > > > > > > > > > > What have I done wrong? > > > > > > > > > > > > > > Cheers, > > > > > > > > > > > > > > Martha > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > Post: opendatakit@googlegroups.com > > > > > > > > > > > > > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > > > > > > > > > > > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > > > > > > > > > > > > > > > > > > > > > > > --- > > > > > > > > > > > > > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > > > > > > > > > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > > > > > > > > > > > > > > > > > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > -- > > > > > > > Nik > > > > > > > Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop me an email. > > > > > > > > > > > > -- > > > > > > -- > > > > > > Post: opendatakit@googlegroups.com > > > > > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > > > > > Options: http://groups.google.com/group/opendatakit?hl=en > > > > > > > > > > > > --- > > > > > > You received this message because you are subscribed to the Google Groups "ODK Community" group. > > > > > > To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com. > > > > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > -- > > > > > > -- > > > Nik > > > Need help customizing Survey Instruments/Tools/Forms for ODK Collect? Drop me an email.