I am designing a form in ODK Survey. I have a multiple response question,
with ten choices. I need to accomplish two things:

One of the choices is "other." If a respondent selects "other" I need
to have a follow-up question.

Require at least one response to the multiple response question.

I frequently condition on responses to select_one questions using, for
instance, if selected(data('Q1'), '11'), where other == 11. However, this
doesn't work because if a respondent selects options 2, 4 and 11, the data
for Q1 is "2,4,11" or something similar. Is there a way to condition on
response #11, given that the total number of responses to Q1 might vary?

I hacked together an alternate version where I used 11 select_one responses
on a single screen, which worked fine. Then I can condition on whether the
11th response is a 1 or a null. However, I need to force the respondent to
answer at least one of these options. So then I face a totally different
problem: how to require a response to at least one of several questions on
a screen. Perhaps there is a back-end calculation I can do (add up
responses to all questions on screen, check if equal to 1 or greater)
before allowing the respondent to move on?

Any suggestions -- for either approach -- would be great. Thanks!

Attached gives you a template which you can use to structure what you need.
In short this has a multiple response that limits a total of 3 choices (but
this can be changed) and does not allow for to select 'None' and other
options together. It also conditions an 'Other Specify' question on a
previous question.

ยทยทยท
On Wednesday, August 17, 2016 at 7:32:28 PM UTC-5, brenton....@gmail.com wrote:
>
> I am designing a form in ODK Survey. I have a multiple response question,
> with ten choices. I need to accomplish two things:
>
> 1. One of the choices is "other." If a respondent selects "other" I need
> to have a follow-up question.
>
> 2. Require at least one response to the multiple response question.
>
> I frequently condition on responses to select_one questions using, for
> instance, if selected(data('Q1'), '11'), where other == 11. However, this
> doesn't work because if a respondent selects options 2, 4 and 11, the data
> for Q1 is "2,4,11" or something similar. Is there a way to condition on
> response #11, given that the total number of responses to Q1 might vary?
>
> I hacked together an alternate version where I used 11 select_one
> responses on a single screen, which worked fine. Then I can condition on
> whether the 11th response is a 1 or a null. However, I need to force the
> respondent to answer at least one of these options. So then I face a
> totally different problem: how to require a response to at least one of
> several questions on a screen. Perhaps there is a back-end calculation I
> can do (add up responses to all questions on screen, check if equal to 1 or
> greater) before allowing the respondent to move on?
>
> Any suggestions -- for either approach -- would be great. Thanks!
>
>
>

You should be able to do this. I've attached an example. If you look
at the calculates worksheet, the expand_walking calculation does this. If
the data_value that you are using on the choices list is an integer, this
could cause an issue. As long as you are using text, this should work.

The attached does something similar via the total_time integer. Here
total_time is being used to calculate the total time spent in transit to
determine the times given during data collection are correct. In your
case, you could add one to an integer and then at the end verify that you
have a value greater than 0 as you mention above. You also have the
ability to put valid JavaScript functions into the calculates worksheet.
The attached file has examples of this.

I am designing a form in ODK Survey. I have a multiple response question,
with ten choices. I need to accomplish two things:

One of the choices is "other." If a respondent selects "other" I need
to have a follow-up question.

Require at least one response to the multiple response question.

I frequently condition on responses to select_one questions using, for
instance, if selected(data('Q1'), '11'), where other == 11. However, this
doesn't work because if a respondent selects options 2, 4 and 11, the data
for Q1 is "2,4,11" or something similar. Is there a way to condition on
response #11, given that the total number of responses to Q1 might vary?

I hacked together an alternate version where I used 11 select_one
responses on a single screen, which worked fine. Then I can condition on
whether the 11th response is a 1 or a null. However, I need to force the
respondent to answer at least one of these options. So then I face a
totally different problem: how to require a response to at least one of
several questions on a screen. Perhaps there is a back-end calculation I
can do (add up responses to all questions on screen, check if equal to 1 or
greater) before allowing the respondent to move on?

Any suggestions -- for either approach -- would be great. Thanks!

Brilliant! I used your solution, Clarice. Though, I also benefited from
Lloyd's response because it helped me work through a related problem by
showing me how to approach the problem of restricting the number of
responses in a multiple response question.

One follow-up question:

My form has two select_multiple questions. I want to have a question that
is asked only if the answers to these two select_multiple questions are
identical. Imagine I have Q1 and Q2, each select_multiple. And I want to
condition asking Q3. I tried the following condition, which works for
single response questions but not multiple response:

data('Q1') == data('Q2')

I also tried playing around with calculations but couldn't get anything to
work.

Any guidance would be helpful!

ยทยทยท
On Wednesday, August 17, 2016 at 10:09:42 PM UTC-4, clarice larson wrote:
>
> 1. You should be able to do this. I've attached an example. If you look
> at the calculates worksheet, the expand_walking calculation does this. If
> the data_value that you are using on the choices list is an integer, this
> could cause an issue. As long as you are using text, this should work.
>
> 2. The attached does something similar via the total_time integer. Here
> total_time is being used to calculate the total time spent in transit to
> determine the times given during data collection are correct. In your
> case, you could add one to an integer and then at the end verify that you
> have a value greater than 0 as you mention above. You also have the
> ability to put valid JavaScript functions into the calculates worksheet.
> The attached file has examples of this.
>
> Clarice
>
> On Wed, Aug 17, 2016 at 5:32 PM, <brenton....@gmail.com > wrote:
>
>> I am designing a form in ODK Survey. I have a multiple response
>> question, with ten choices. I need to accomplish two things:
>>
>> 1. One of the choices is "other." If a respondent selects "other" I need
>> to have a follow-up question.
>>
>> 2. Require at least one response to the multiple response question.
>>
>> I frequently condition on responses to select_one questions using, for
>> instance, if selected(data('Q1'), '11'), where other == 11. However, this
>> doesn't work because if a respondent selects options 2, 4 and 11, the data
>> for Q1 is "2,4,11" or something similar. Is there a way to condition on
>> response #11, given that the total number of responses to Q1 might vary?
>>
>> I hacked together an alternate version where I used 11 select_one
>> responses on a single screen, which worked fine. Then I can condition on
>> whether the 11th response is a 1 or a null. However, I need to force the
>> respondent to answer at least one of these options. So then I face a
>> totally different problem: how to require a response to at least one of
>> several questions on a screen. Perhaps there is a back-end calculation I
>> can do (add up responses to all questions on screen, check if equal to 1 or
>> greater) before allowing the respondent to move on?
>>
>> Any suggestions -- for either approach -- would be great. Thanks!
>>
>>
>> --
>> --
>> Post: opend...@googlegroups.com
>> Unsubscribe: opendatakit...@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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

In terms of how to check if two arrays are equal, you could take advantage
of the Underscore.js library that is included in Survey. You could check
for equality using the _.isEqual function. I've attached an example. You
will want to look at the trans_eq calculation.

Brilliant! I used your solution, Clarice. Though, I also benefited from
Lloyd's response because it helped me work through a related problem by
showing me how to approach the problem of restricting the number of
responses in a multiple response question.

One follow-up question:

My form has two select_multiple questions. I want to have a question that
is asked only if the answers to these two select_multiple questions are
identical. Imagine I have Q1 and Q2, each select_multiple. And I want to
condition asking Q3. I tried the following condition, which works for
single response questions but not multiple response:

data('Q1') == data('Q2')

I also tried playing around with calculations but couldn't get anything to
work.

Any guidance would be helpful!

On Wednesday, August 17, 2016 at 10:09:42 PM UTC-4, clarice larson wrote:

You should be able to do this. I've attached an example. If you
look at the calculates worksheet, the expand_walking calculation does
this. If the data_value that you are using on the choices list is an
integer, this could cause an issue. As long as you are using text, this
should work.

The attached does something similar via the total_time integer. Here
total_time is being used to calculate the total time spent in transit to
determine the times given during data collection are correct. In your
case, you could add one to an integer and then at the end verify that you
have a value greater than 0 as you mention above. You also have the
ability to put valid JavaScript functions into the calculates worksheet.
The attached file has examples of this.

I am designing a form in ODK Survey. I have a multiple response
question, with ten choices. I need to accomplish two things:

One of the choices is "other." If a respondent selects "other" I
need to have a follow-up question.

Require at least one response to the multiple response question.

I frequently condition on responses to select_one questions using, for
instance, if selected(data('Q1'), '11'), where other == 11. However, this
doesn't work because if a respondent selects options 2, 4 and 11, the data
for Q1 is "2,4,11" or something similar. Is there a way to condition on
response #11, given that the total number of responses to Q1 might vary?

I hacked together an alternate version where I used 11 select_one
responses on a single screen, which worked fine. Then I can condition on
whether the 11th response is a 1 or a null. However, I need to force the
respondent to answer at least one of these options. So then I face a
totally different problem: how to require a response to at least one of
several questions on a screen. Perhaps there is a back-end calculation I
can do (add up responses to all questions on screen, check if equal to 1 or
greater) before allowing the respondent to move on?

Any suggestions -- for either approach -- would be great. Thanks!

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