- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Logic for sub-question
- ada1
- Topic Author
- Offline
- New Member
Less
More
8 years 10 months ago #120566
by ada1
Logic for sub-question was created by ada1
For example, I have 2 questions:
1. What class are you studying?
Class A
Class B
Class C
2. What is your favorite subject?
****** show next subjects if checked "Class A"******
Math
History
English
****** show next subjects if checked "Class B"******
Physics
Chemistry
I need to show only those answers of question #2 depending on answer has been checked in question #1.
How can I do this? Should I use expressions and javascipt? Or there is another good solution?
Sorry for my bad english
1. What class are you studying?
Class A
Class B
Class C
2. What is your favorite subject?
****** show next subjects if checked "Class A"******
Math
History
English
****** show next subjects if checked "Class B"******
Physics
Chemistry
I need to show only those answers of question #2 depending on answer has been checked in question #1.
How can I do this? Should I use expressions and javascipt? Or there is another good solution?
Sorry for my bad english
The topic has been locked.
- rother
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 10 months ago #120579
by rother
Replied by rother on topic Logic for sub-question
I took a quick look at the manual as I don't have experience with limesurvey. It doesn't seem to offer this functionality or I might overlooked it.
Anyways, as a workaround, you can split question 2 in 2 questions and then using condition logic based on Q1 to redirect respondents to the respected question. Afterwards you can easily merge them during data processing if you need the data reported in one table.
Hope it helps.
Anyways, as a workaround, you can split question 2 in 2 questions and then using condition logic based on Q1 to redirect respondents to the respected question. Afterwards you can easily merge them during data processing if you need the data reported in one table.
Hope it helps.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
8 years 10 months ago #120585
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 Logic for sub-question
I think this can easily be done, if you split up question 2 into 3 (for each class one), then you show the respective question with the class A/B/C subquestions with relevance equations for each of those questions 2 versions.
There might be a solution that can do this in one question, but I think it would involve custom coding in Javascript and a hidden question.
You would hide a multiple choice question that has all possible subjects included and according to the answers to question 1 you will mark the relevant subjects via Javascript. Then you can use the array_filter with the next question (Q2), based on what was marked in the hidden question.
By the way: is the first question multiple answers or single answer?
There might be a solution that can do this in one question, but I think it would involve custom coding in Javascript and a hidden question.
You would hide a multiple choice question that has all possible subjects included and according to the answers to question 1 you will mark the relevant subjects via Javascript. Then you can use the array_filter with the next question (Q2), based on what was marked in the hidden question.
By the way: is the first question multiple answers or single answer?
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- ada1
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
8 years 10 months ago #120589
by ada1
Replied by ada1 on topic Logic for sub-question
Thanks a lot rother, holch.
It's a good solution, but it was just an example. In fact, I have many questions (about 10) like second question, and answers of these questions must show depending on question #1.
Single answer.
I think this can easily be done, if you split up question 2 into 3 (for each class one), then you show the respective question with the class A/B/C subquestions with relevance equations for each of those questions 2 versions.
It's a good solution, but it was just an example. In fact, I have many questions (about 10) like second question, and answers of these questions must show depending on question #1.
By the way: is the first question multiple answers or single answer?
Single answer.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11746
- Thank you received: 2750
8 years 10 months ago #120590
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 Logic for sub-question
As it is single answer, the respondents won't even notice that there are various versions of question 2.
I personally would create as many question 2 versions (q2a, q2b, q2c) as necessary. It is a simple and easy solution, without the need of custom coding. It does require the creation of about 10 questions, but any other solution will cost you a lot more time than creating these questions and use relevance equations to show/hide the questions, depending on the answer in Q1.
I personally would create as many question 2 versions (q2a, q2b, q2c) as necessary. It is a simple and easy solution, without the need of custom coding. It does require the creation of about 10 questions, but any other solution will cost you a lot more time than creating these questions and use relevance equations to show/hide the questions, depending on the answer in Q1.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: ada1
The topic has been locked.
- ada1
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
8 years 9 months ago #120631
by ada1
Replied by ada1 on topic Logic for sub-question
Thanks a lot. But, if I'll do this, i'll have about 60 questions (10 qusetions like q #2 * 6 classes). And it will be very hard to change anything about subjects (for example: if I need to add a new subject for certain class).
I can't bealive that limesurvey doesn't support logical manipulations for answers (except for array filter, but i my way it's just a half solution, because questoin 1 is not like other questions).
P.S. I tried to use hidden question with the entire list of all subjects (there are about 50), in order to manupulating answers of remaining questions using array filter, and when I'd added 5 and more questions (with array filter), my limesurvey had broken (html script). I think, it'd broken because of huge amount of answers.
Please help me, also I can upload .lss file for better understanding.
I can't bealive that limesurvey doesn't support logical manipulations for answers (except for array filter, but i my way it's just a half solution, because questoin 1 is not like other questions).
P.S. I tried to use hidden question with the entire list of all subjects (there are about 50), in order to manupulating answers of remaining questions using array filter, and when I'd added 5 and more questions (with array filter), my limesurvey had broken (html script). I think, it'd broken because of huge amount of answers.
Please help me, also I can upload .lss file for better understanding.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3691
8 years 9 months ago #120632
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Logic for sub-question
Here is an example of the array filter solution that holch refers to -
www.limesurvey.org/en/forum/can-i-do-thi...ious-question#119674
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ada1
The topic has been locked.
- ada1
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
8 years 9 months ago #120636
by ada1
Replied by ada1 on topic Logic for sub-question
Thak you. I'll try it
The topic has been locked.