- Posts: 74
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
multi-choice question getting response options from previous questions
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
7 years 1 month ago #148150
by Winocll_48635
multi-choice question getting response options from previous questions was created by Winocll_48635
So i have two multi-choice questions, each having the exact same options to choose from. The second question should only pull in responses that were checked off in the first question. For example...
Q1: Which fruits do you like?
01 - Apples
02 - Pears
03 - Bananas
04 - Oranges
05 - Strawberries
Q2: Which two or three of those fruits do you like the best?
01 - Apples
02 - Pears
03 - Bananas
04 - Oranges
05 - Strawberries
For subquestion code 01 in the second question i put this code...
{if(q1_01=="Y",join("- ",q2_01.question,": ",q2_01.shown),"")}
And even though it will not show the text of "01 Apples" in Q2, it does still show the checkbox...which i need hidden.
I also need to know how to only get Q2 if more than one answers are checked in Q1...can't quite figure that out.
Q1: Which fruits do you like?
01 - Apples
02 - Pears
03 - Bananas
04 - Oranges
05 - Strawberries
Q2: Which two or three of those fruits do you like the best?
01 - Apples
02 - Pears
03 - Bananas
04 - Oranges
05 - Strawberries
For subquestion code 01 in the second question i put this code...
{if(q1_01=="Y",join("- ",q2_01.question,": ",q2_01.shown),"")}
And even though it will not show the text of "01 Apples" in Q2, it does still show the checkbox...which i need hidden.
I also need to know how to only get Q2 if more than one answers are checked in Q1...can't quite figure that out.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
7 years 1 month ago - 7 years 1 month ago #148158
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic multi-choice question getting response options from previous questions
I think you are going too complicated.
First solution: use Array filter. It should work with multiple choice questions as well: manual.limesurvey.org/QS:Array_filter/en
I am not too sure what you are trying to do with the expression you are showing.
To show only the responses that have been marked in the first question you should only write this into the relevance equation for this subquestion:
If that is not what you are looking for, provide a copy of the survey with only those two questions so that we can look at what you are trying to do.
First solution: use Array filter. It should work with multiple choice questions as well: manual.limesurvey.org/QS:Array_filter/en
I am not too sure what you are trying to do with the expression you are showing.
To show only the responses that have been marked in the first question you should only write this into the relevance equation for this subquestion:
Code:
q1_01 == 'Y'
If that is not what you are looking for, provide a copy of the survey with only those two questions so that we can look at what you are trying to do.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 7 years 1 month ago by holch.
The following user(s) said Thank You: Winocll_48635
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13910
- Thank you received: 2548
7 years 1 month ago #148169
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic multi-choice question getting response options from previous questions
And for hidding Q2 if Q1 have more than 1 answer: count(Q1.NAOK)>0
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Winocll_48635
The topic has been locked.
- Winocll_48635
- Topic Author
- Offline
- Banned
Less
More
- Posts: 74
- Thank you received: 1
7 years 1 month ago #148227
by Winocll_48635
Replied by Winocll_48635 on topic multi-choice question getting response options from previous questions
thank you both...your answers worked like a charm.
The topic has been locked.