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
  • AllesMeins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 11 months ago #153342 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:
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago #153366 by tpartner
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.

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
  • AllesMeins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 11 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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago #153393 by tpartner
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
  • AllesMeins's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 11 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"?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago - 6 years 11 months ago #153431 by tpartner
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):
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 11 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose