Page:12

## Fill in a multiple choice question based on previous answers 7 months 3 weeks ago #111473

 wilmslow3 OFFLINE Fresh Lemon Posts: 12 Thank you received: 1 Karma: 0 Hi, Just wondering if this is possible, Can you automatically answer a multiple choice question based on previous answers (i.e. radio button questions, multiple choice questions and array questions) Reason being...I want to have a "summary multiple choice question" that based on previous answers ticks a multiple choice question. I have a couple of multiple choice questions and a couple of radio buttons questions that when the options are selected a later question records the answers in a "big multiple choice question". (This can be hidden or shown) Is this possible? Ive looked at the EM and can't seem to get it to work - does anyone have any sample surveys they could share with the correct syntax or point me in the right direction. Thanks The administrator has disabled public write access.

## Fill in a multiple choice question based on previous answers 7 months 3 weeks ago #111487

• tpartner
• LimeSurvey Team
• Posts: 4631
• Karma: 408
Yes, you can use equation questions to select the options in the "results" question. These equation questions must be placed after the "results" question.

In the case of multiple options questions the equation is a simple - you can directly tie the "results" option to the "q1" option:
{results_SQ001 = q1_SQ001}

In the case of radio questions you will need to define which answer will result in a checked box in the "results" question. The easiest way to do that is to simply give that radio answer a code of "Y". Then you can tie them directly in the equation:
{results_SQ002 = q2}

If you can not use an answer code of "Y", you will need to put in a intermediary equation question to define "Y". So, for example, if I had a radio question (lets call it "q3") where I wanted answer code "A1" to check the box in "results", my intermediary equation (lets call it "equation1") would be:
if(q3 == 'A1', 'Y', '')
This would be followed by another equation question to control "results":
results_SQ003 = equation1

Here's a working example for LS2.05.

#### File Attachment:

File Name: limesurvey_survey_235541_2014-08-07.lss
File Size: 24 KB

## Fill in a multiple choice question based on previous answers 7 months 3 weeks ago #111501

 Ben_V OFFLINE Platinum Lime Posts: 1273 Thank you received: 296 Karma: 86 Hello Tony, Very kind explanations & sample...as you used to provide! Is this method already explained somewhere in the manual (and where)? Benoît goo.gl/Bw5iM => Recherche GG dans le forum français (remplacer "exemple" dans la barre de recherche) goo.gl/WX8PH => GG search for english forum (Replace "example" in the search bar) goo.gl/IxiGu => Búsqueda en el foro en español (Cambiar "ejemplo" en la barra de... The administrator has disabled public write access.

## Fill in a multiple choice question based on previous answers 7 months 3 weeks ago #111503

 tpartner OFFLINE LimeSurvey Team Posts: 4631 Thank you received: 924 Karma: 408 Hi Ben, The only thing I could find is here - manual.limesurvey.org/Expression_Manager#Operators Feel free to expand on that if you wish. . Cheers, Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise. LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project. The administrator has disabled public write access. The following user(s) said Thank You: Ben_V

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111528

 david2013 OFFLINE Senior Lime Posts: 41 Thank you received: 4 Karma: 2 Can we use one equation question instead of two? for example, results_SQ003 = if(q3 == 'A1', 'Y', ''). The administrator has disabled public write access.

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111530

 tpartner OFFLINE LimeSurvey Team Posts: 4631 Thank you received: 924 Karma: 408 I'm not sure why but that didn't work for me in testing. Cheers, Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise. LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project. The administrator has disabled public write access. The following user(s) said Thank You: wilmslow3

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111542

 wilmslow3 OFFLINE Fresh Lemon Posts: 12 Thank you received: 1 Karma: 0 Thanks TPartner Your solution is perfect for my needs, really good explanation and I'm sure I'll be using a few variations for the future. With this I have implemented a filter in an array question based on two questions into my questionnaire using this method. See www.limesurvey.org/en/forum/can-i-do-thi...swers-of-2-questions and www.limesurvey.org/en/forum/can-i-do-thi...ter-on-two-questions I have two questions 10a and 10b at Q9 people select what bands they have heard of at 10a people select their favourite band (array filter of Q9) at 10b people select other top 4 bands (with array filter of Q9 and array exclusion of 10a) At 10c Peple can rate the bands they have slected in q10a and 10b in an array question. (array filter from results) So inbetween 10b and 10c I load a equation (Sum1, Sum2 etc) for each of the options using: {if(Q10a_A1=='Y','Y',Q10b_A1)} then {Results_A1 = Sum1} The administrator has disabled public write access. The following user(s) said Thank You: Ben_V

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111544

 tpartner OFFLINE LimeSurvey Team Posts: 4631 Thank you received: 924 Karma: 408 That's a great explanation of a real-world application. Cheers, Tony Partner Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise. LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project. The administrator has disabled public write access. The following user(s) said Thank You: wilmslow3

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111554

 holch NOW ONLINE LimeSurvey Team Posts: 3318 Thank you received: 441 Karma: 140 Nice, but with a little tweaking the problem wouldn't have been a problem... Ask in 10a for the top 5 bands from Q9 and then from those top 5 bands ask for the single most favorite band. Then you could do the filter of 10c based on 10a and you don't need to have it from 2 different question. In your case I also don't see a need for the specific order you had (sometimes this could have had an impact and the technical solution would have been really necessary). But in your case I would have just switched the order of the questions and the problem would be solved by the array filter out of the box. Have a look at the manual! It is a really valuable source for information. Here some helpful links: Manual (EN) | Question Types | Question Attributes | Workarounds If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going! The administrator has disabled public write access. The following user(s) said Thank You: wilmslow3

## Fill in a multiple choice question based on previous answers 7 months 2 weeks ago #111555

 wilmslow3 OFFLINE Fresh Lemon Posts: 12 Thank you received: 1 Karma: 0 holch wrote: Nice, but with a little tweaking the problem wouldn't have been a problem... Ask in 10a for the top 5 bands from Q9 and then from those top 5 bands ask for the single most favorite band. Then you could do the filter of 10c based on 10a and you don't need to have it from 2 different question. In your case I also don't see a need for the specific order you had (sometimes this could have had an impact and the technical solution would have been really necessary). But in your case I would have just switched the order of the questions and the problem would be solved by the array filter out of the box. Thanks, yes that would have worked, unfortunatly soemtimes you dont get the luxury of changing questions in a survey 'i.e. clients!!!' Also my actual survey filtering is a lot more complex to what I actually posted, I thought I'd try and simplify it to post the solution. The administrator has disabled public write access.
 Page:12
Moderators: ITEd
Time to create page: 0.338 seconds