- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Record answer for skipped (non-relevant) question
- AllesMeins
- Topic Author
- Offline
- New Member
Less
More
6 years 10 months ago #153342
by AllesMeins
Record answer for skipped (non-relevant) question was created by AllesMeins
I need to build a survey that lets the user first select a number of choices and than asks for the preffered choice of the selected:
Of course Q02 is only relevant, if the user has selected more than one answer in the first question. So if the user selects only one fruit, I want to record this fruit as his favourite (=copy the answer from Q01 to Q02) and don't bother him with a Q02 that has only one option.
I've managed the "skip Q02 if there is only one choice"-part, but I'm lost on how to automatically store it as the users favorite fruit. Can anybody help me with that?
Code:
Q01: What fruits do you eat? (multiple choice) Q02: Which is your favourite? (single choice of the previously selected)
Of course Q02 is only relevant, if the user has selected more than one answer in the first question. So if the user selects only one fruit, I want to record this fruit as his favourite (=copy the answer from Q01 to Q02) and don't bother him with a Q02 that has only one option.
I've managed the "skip Q02 if there is only one choice"-part, but I'm lost on how to automatically store it as the users favorite fruit. Can anybody help me with that?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
6 years 10 months ago #153366
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 Record answer for skipped (non-relevant) question
You cannot store data in a question that is hidden via relevance.
Having said that, it seems to me that if the respondent only picks one item in Q1, you already know their favorite.
Having said that, it seems to me that if the respondent only picks one item in Q1, you already know their favorite.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- AllesMeins
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
6 years 10 months ago #153382
by AllesMeins
Replied by AllesMeins on topic Record answer for skipped (non-relevant) question
Thanks for your reply. Yes, if he only picks one I know his favourite. But how do I record that correctly, so that in the end I've all favourites in one result?
Lets say lemon-lovers hate all other fruit and only pick "lemon" in Q1. So lemon will never show up in Q2. How can I put the data together so that I end up with one "favourite"-stat including the values from Q2 and the single-picks from Q1?
Lets say lemon-lovers hate all other fruit and only pick "lemon" in Q1. So lemon will never show up in Q2. How can I put the data together so that I end up with one "favourite"-stat including the values from Q2 and the single-picks from Q1?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
6 years 10 months ago #153393
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 Record answer for skipped (non-relevant) question
I would think that would be fairly simple to do in post-survey analysis but, if you need it explicitly declared in the data, you could use the Expression Manager assignment operator to load a hidden equation type question with that value.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- AllesMeins
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
6 years 10 months ago #153430
by AllesMeins
Replied by AllesMeins on topic Record answer for skipped (non-relevant) question
Since I'm unfortunatly not involved in the analysis I want to make it as idiot-proof as possible, so I'm going to try my luck with the expression manager
Is there a fast way to "translate" from the multiple choice to a single-value? What I could do is use a lot of ifs (something like: if(Q01_SQ01,Q02='SQ01')...if(Q01_SQ12,Q02='SQ12')) but maybe there is a more elegant solution - some kind of "give me the name of the selected subvalues"?
Is there a fast way to "translate" from the multiple choice to a single-value? What I could do is use a lot of ifs (something like: if(Q01_SQ01,Q02='SQ01')...if(Q01_SQ12,Q02='SQ12')) but maybe there is a more elegant solution - some kind of "give me the name of the selected subvalues"?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10611
- Thank you received: 3690
6 years 10 months ago - 6 years 10 months ago #153431
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 Record answer for skipped (non-relevant) question
No, sadly there is no EM variable for all selected items in a multi-choice.
So, I imagine your expression would look something like this (line-breaks inserted for clarity):
Note that it is advised to place the equation question in a group following Q1 and Q2.
So, I imagine your expression would look something like this (line-breaks inserted for clarity):
Code:
{equation1 = (if(count(that.Q1) > 1, Q2.shown, if(Q1_1 == 'Y', Q1_1.shown, if(Q1_2 == 'Y', Q1_2.shown, if(Q1_3 == 'Y', Q1_3.shown, if(Q1_4 == 'Y', Q1_4.shown, '' ))))))}
Note that it is advised to place the equation question in a group following Q1 and Q2.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 years 10 months ago by tpartner.
The topic has been locked.