Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Error setting and passing answers to follow up questions.

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 6 months ago - 2 years 6 months ago #226119 by davebostockgmail
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.3.4+220309
Own server or LimeSurvey hosting: Own Server
Survey theme/template:
==================
Not sure if this is related to my last issue .. although I think it maybe but this is one where I can share an LSS to see if anyone else has the same issue and knows if there is something I should be doing differently.

The issue is where we have a multiple choice question - Which colours do you like? for example ... and then if they select more than one we ask a list question to determine the favourite colour. The answer from the favourite colour is then used in the answer options of an Array ... This is fine if the respondent sees the list question and works as expected. If however at the first question then we set the list question using an equation as it is redundant to ask a question with only one answer. This is where the issue lies .. the text no longer comes through in the final question.

I have attached a simple LSS file to show this in action ... hopefully it is not an install issue.

Thanks as always for everyones help and advice
Dave

This worked as expected in 3.x

 

File Attachment:

File Name: Example.lss
File Size:46 KB


 
Last edit: 2 years 6 months ago by davebostockgmail. Reason: updating information

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago - 2 years 6 months ago #226125 by tpartner
I'm not sure how that could have worked if you render Q2 irrelevant when there is less than 2 answers in Q1.

I think you will need to:

1) Remove the relevance from SetQ2, and hide it with a CSS class, and insert this as the equation (line breaks inserted for clarity):
 
 
Code:
{if(count(that.Q1.NAOK) > 1, Q2.shown,
if(!is_empty(Q1_1.NAOK), Q1_1.question,
if(!is_empty(Q1_2.NAOK), Q1_2.question,
if(!is_empty(Q1_3.NAOK), Q1_3.question,
if(!is_empty(Q1_4.NAOK), Q1_4.question,
if(!is_empty(Q1_5.NAOK), Q1_5.question,
if(!is_empty(Q1_6.NAOK), Q1_6.question, '')))))))}

2) Then you can simply use this in the sub-question texts of the array:

Code:
{SetQ2}

Sample survey attached: 

File Attachment:

File Name: limesurvey...8141.lss
File Size:45 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 2 years 6 months ago by tpartner.

Please Log in to join the conversation.

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 6 months ago #226165 by davebostockgmail
Replied by davebostockgmail on topic Error setting and passing answers to follow up questions.
Thanks Tony

This corrects the text display but doesn't capture the single punch in the data which is needed for analysis by setting the list question value with the value from a single entry in the multiple question.

I guess we will have to do that post collection.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago #226169 by Joffm
You can do it by an equation like (e.g. after the array)
{Q2=if(is_empty(Q2),if(Q1_1=="Y",1,if(Q1_2=="Y",2,if(Q1_3=="Y",3,if(Q1_4=="Y",4,if(Q1_5=="Y",5,6))))),Q2)}

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago #226172 by tpartner
That's what Dave originally had but the problem is that Q2 is hidden via relevance when count(that.Q1) < 2 so nothing can be recorded for Q2 in that case.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • davebostockgmail
  • davebostockgmail's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 6 months ago #226173 by davebostockgmail
Replied by davebostockgmail on topic Error setting and passing answers to follow up questions.
Thanks .. I have combined both of these to get the required result.

Joffm's stores the data and Tony's shows the correct text in the answer option.

I am sure that it used to work out of the box in 3.x but that may just be wishful thinking.

Thanks again for all your help
Have a great weekend
Dave

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose