Reference previous select_one answer choice label in note text

Hi everyone,

I am trying to insert a note widget to remind a survey-taker of a previous answer choice to a select_one question with a list of choices. I.e., "When asked which site you visited, you said: [their choice]." I want them to see the label of their answer choice (i.e. "you said: Walmart.") instead of the corresponding number of their answer choice (i.e. "you said: 1.").

I have been trying to use the jr:choice-name calculation to do this in the following form:

jr:choice-name(${name of earlier question},'${name of earlier question}')

and then referring to the jr:choice-name calculation in the note (i.e. "you said: ${name of jr:choice-name calculate widget}.")

As far as I can tell this doesn't seem to be working. The note appears, but with the answer reference blank ("you said: ."). Does anyone have any idea what the error is/a way to work around this?

Thanks,
Seth

1 Like

Seth,

Store the calculation in a calculate prompt and then reference that
prompt in the label.

Yaw

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

On Wed, Jul 22, 2015 at 3:23 PM, sethzissette@gmail.com wrote:

Hi everyone,

I am trying to insert a note widget to remind a survey-taker of a previous answer choice to a select_one question with a list of choices. I.e., "When asked which site you visited, you said: [their choice]." I want them to see the label of their answer choice (i.e. "you said: Walmart.") instead of the corresponding number of their answer choice (i.e. "you said: 1.").

I have been trying to use the jr:choice-name calculation to do this in the following form:

jr:choice-name(${name of earlier question},'${name of earlier question}')

and then referring to the jr:choice-name calculation in the note (i.e. "you said: ${name of jr:choice-name calculate widget}.")

As far as I can tell this doesn't seem to be working. The note appears, but with the answer reference blank ("you said: ."). Does anyone have any idea what the error is/a way to work around this?

Thanks,
Seth

--

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/d/optout.

Yaw,

Thanks, I tried that but I'm still not having any luck. Basically I've tried two different options at this point and gotten the same result.

First, I tried the jr:choice-name in a calculate prompt:
name: store_choice
calculate: jr:choice-name(${store}, '${store}')

Then I referenced it in the next prompt's label:
name: display_store_choice
label: As a reminder, you said: ${store_choice}.

That didn't work, so then I tried using an if(selected) calculate:
name: store_choice_1
calculate: if(selected(${store}, '1'), 'Walmart', '.')

I left the third argument blank because there were three store choices in the original select_one question; I repeated the calculate three times, one for each choice.

Then:
name: display_store_choice_1
label: As a reminder, you selected: ${store_choice_1}.

I also repeated this three times, once with each choice.

Both of these options still left the label blank no matter what I chose. Is there a way I should be adjusting the if(selected) calculate to account for three choices in the original select_one prompt?

Thanks,
Seth

ยทยทยท On Wednesday, July 22, 2015 at 8:59:45 PM UTC-4, Yaw Anokwa wrote: > Seth, > > Store the calculation in a calculate prompt and then reference that > prompt in the label. > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > > On Wed, Jul 22, 2015 at 3:23 PM, wrote: > > Hi everyone, > > > > I am trying to insert a note widget to remind a survey-taker of a previous answer choice to a select_one question with a list of choices. I.e., "When asked which site you visited, you said: [their choice]." I want them to see the label of their answer choice (i.e. "you said: Walmart.") instead of the corresponding number of their answer choice (i.e. "you said: 1."). > > > > I have been trying to use the jr:choice-name calculation to do this in the following form: > > > > jr:choice-name(${name of earlier question},'${name of earlier question}') > > > > and then referring to the jr:choice-name calculation in the note (i.e. "you said: ${name of jr:choice-name calculate widget}.") > > > > As far as I can tell this doesn't seem to be working. The note appears, but with the answer reference blank ("you said: ."). Does anyone have any idea what the error is/a way to work around this? > > > > Thanks, > > Seth > > > > -- > > -- > > 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/d/optout.

Seth,

Attached is an example. This one is a little more than you need
because I also show the value from an 'Other, please specify'
question.

Hope it helps,

Yaw

crops.xlsx (10.7 KB)

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

On Thu, Jul 23, 2015 at 8:47 AM, sethzissette@gmail.com wrote:

Yaw,

Thanks, I tried that but I'm still not having any luck. Basically I've tried two different options at this point and gotten the same result.

First, I tried the jr:choice-name in a calculate prompt:
name: store_choice
calculate: jr:choice-name(${store}, '${store}')

Then I referenced it in the next prompt's label:
name: display_store_choice
label: As a reminder, you said: ${store_choice}.

That didn't work, so then I tried using an if(selected) calculate:
name: store_choice_1
calculate: if(selected(${store}, '1'), 'Walmart', '.')

I left the third argument blank because there were three store choices in the original select_one question; I repeated the calculate three times, one for each choice.

Then:
name: display_store_choice_1
label: As a reminder, you selected: ${store_choice_1}.

I also repeated this three times, once with each choice.

Both of these options still left the label blank no matter what I chose. Is there a way I should be adjusting the if(selected) calculate to account for three choices in the original select_one prompt?

Thanks,
Seth

On Wednesday, July 22, 2015 at 8:59:45 PM UTC-4, Yaw Anokwa wrote:

Seth,

Store the calculation in a calculate prompt and then reference that
prompt in the label.

Yaw

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

On Wed, Jul 22, 2015 at 3:23 PM, sethzissette@gmail.com wrote:

Hi everyone,

I am trying to insert a note widget to remind a survey-taker of a previous answer choice to a select_one question with a list of choices. I.e., "When asked which site you visited, you said: [their choice]." I want them to see the label of their answer choice (i.e. "you said: Walmart.") instead of the corresponding number of their answer choice (i.e. "you said: 1.").

I have been trying to use the jr:choice-name calculation to do this in the following form:

jr:choice-name(${name of earlier question},'${name of earlier question}')

and then referring to the jr:choice-name calculation in the note (i.e. "you said: ${name of jr:choice-name calculate widget}.")

As far as I can tell this doesn't seem to be working. The note appears, but with the answer reference blank ("you said: ."). Does anyone have any idea what the error is/a way to work around this?

Thanks,
Seth

--

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/d/optout.

3 Likes

Thanks Yaw, that did the trick!

Best,
Seth

ยทยทยท On Thursday, July 23, 2015 at 7:19:42 PM UTC-4, Yaw Anokwa wrote: > Seth, > > Attached is an example. This one is a little more than you need > because I also show the value from an 'Other, please specify' > question. > > Hope it helps, > > Yaw > -- > Need ODK services? http://nafundi.com provides form design, server > setup, professional support, and software development for ODK. > > On Thu, Jul 23, 2015 at 8:47 AM, wrote: > > Yaw, > > > > Thanks, I tried that but I'm still not having any luck. Basically I've tried two different options at this point and gotten the same result. > > > > First, I tried the jr:choice-name in a calculate prompt: > > name: store_choice > > calculate: jr:choice-name(${store}, '${store}') > > > > Then I referenced it in the next prompt's label: > > name: display_store_choice > > label: As a reminder, you said: ${store_choice}. > > > > That didn't work, so then I tried using an if(selected) calculate: > > name: store_choice_1 > > calculate: if(selected(${store}, '1'), 'Walmart', '.') > > > > I left the third argument blank because there were three store choices in the original select_one question; I repeated the calculate three times, one for each choice. > > > > Then: > > name: display_store_choice_1 > > label: As a reminder, you selected: ${store_choice_1}. > > > > I also repeated this three times, once with each choice. > > > > Both of these options still left the label blank no matter what I chose. Is there a way I should be adjusting the if(selected) calculate to account for three choices in the original select_one prompt? > > > > Thanks, > > Seth > > > > > > > > On Wednesday, July 22, 2015 at 8:59:45 PM UTC-4, Yaw Anokwa wrote: > >> Seth, > >> > >> Store the calculation in a calculate prompt and then reference that > >> prompt in the label. > >> > >> Yaw > >> -- > >> Need ODK services? http://nafundi.com provides form design, server > >> setup, professional support, and software development for ODK. > >> > >> > >> On Wed, Jul 22, 2015 at 3:23 PM, wrote: > >> > Hi everyone, > >> > > >> > I am trying to insert a note widget to remind a survey-taker of a previous answer choice to a select_one question with a list of choices. I.e., "When asked which site you visited, you said: [their choice]." I want them to see the label of their answer choice (i.e. "you said: Walmart.") instead of the corresponding number of their answer choice (i.e. "you said: 1."). > >> > > >> > I have been trying to use the jr:choice-name calculation to do this in the following form: > >> > > >> > jr:choice-name(${name of earlier question},'${name of earlier question}') > >> > > >> > and then referring to the jr:choice-name calculation in the note (i.e. "you said: ${name of jr:choice-name calculate widget}.") > >> > > >> > As far as I can tell this doesn't seem to be working. The note appears, but with the answer reference blank ("you said: ."). Does anyone have any idea what the error is/a way to work around this? > >> > > >> > Thanks, > >> > Seth > >> > > >> > -- > >> > -- > >> > 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/d/optout. > >