Welcome to the LimeSurvey Community Forum

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

Hide answer options based on prior multiple choice question answers

  • keithgoldstein
  • keithgoldstein's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago #255543 by keithgoldstein
LimeSurvey version:5.6.8
Own server
==================
I have a multiple choice question. For example: What kinds of fruit do you like to eat the most? apples, oranges, grapes, pears, bananas, figs...
I then have a single choice list with comment. For example: Which one of these fruits did you last eat? <answers from previous question> (Comment) What else did you eat with it?
I have tried various methods of the expression manager, and I normally would be able to easily solve this if these were subquestions.
I tried combinations of {G01_AO01.NAOK!=""}A, and {!is_empty(  which bring up the word "True", but they don't hide the answer options.

Apologies if this has been covered. I really searched for an answer and found the following relevant discussion about hiding options with an array question, but it doesn't quite solve my issue:  How to display/hide subquestions based on dual scale answers? - LimeSurvey Forums
I'm not sure if I need to add assessment values:  Adding answers or subquestions - LimeSurvey Manual
I also find this solution perhaps, but I haven't succeeded in getting it to work.  Can I hide a particular subquestion or answer using Expression Manager - LimeSurvey Forums

Please Log in to join the conversation.

  • keithgoldstein
  • keithgoldstein's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 3 weeks ago - 2 months 3 weeks ago #255546 by keithgoldstein
I add that it seems I can solve the problem by creating an equation and then a hidden multiple choice question that reads that equation and pipes the answers to a single choice radio option with an array filter, but the array filter is not available in the list with comment options. For the time being I put the open comment in a separate question and use that option. This solution also only works when the 2nd question is in a different block. This was really complicated to solve, and I wonder whether there might be an easier way to solve this that works better.
Last edit: 2 months 3 weeks ago by keithgoldstein. Reason: added that it needs to go on another block.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago #255549 by Joffm

that it seems I can solve the problem by creating an equation and then a hidden multiple choice question that reads that equation and pipes the answers to a single choice radio option with an array filter,

You want to create a multiple question set by an equation?
What for?
You already have this multiple question

You only set the array filter of the second - single - question on this first - multiple- question.
The array filter is straightforward and - to be honest - your question "What did you eat with {Q2.shown}?" is a different question and not a comment.
So this approach with three questions is appealing, easy to understand by the respondent, and really easy to implement.

Joffm

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

Please Log in to join the conversation.

  • keithgoldstein
  • keithgoldstein's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago #255696 by keithgoldstein
Thank you for your attempt to understand the issue @Joffm . I actually used a template that you wrote, but it was to combine 2 multiple choice questions' answers into one, so there is probably a redundancy with the hidden multiple choice question in Block A.

Please see the attached survey I created.  

File Attachment:

File Name: limesurvey...7191.lss
File Size:192 KB


This is just an example. It is obviously not my actual survey, and I have reasons for wanting to use the list with comment question type. Blocks A and B show the solution I created. Block C shows the solution that I would like to achieve.

My main issue is that I want to have the first multiple choice question and the second single choice question on the same page (in the same block).

The second issue is that I would like to have the comment in the same question. There is no need for the piped in expression of the fruits that I added in B.

Thanks again for all of your help.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #255697 by DenisChenu
The easy way :

- List of choice with Array filter
- A comment

Use 2 questions and not a list with comment

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago - 2 months 2 weeks ago #255702 by Joffm
Hi,
@Denis told you the same, I wrote before.

And with some css you may
merge the questions vertically by the css classes "no-question" and "no-bottom"
 
and with a small script you may
merge the question horizontally
 

Now it's up to you what you prefer.


Joffm

BTW:
1. This small script in your question.
Was it to move the "other" option to the top?
But there is a setting to do this.

2. I wrote before, this hidden question and the equation are not necessary.
Here you only copy the first multiple question.
Set thr array filter directly to this question.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 months 2 weeks ago by Joffm.

Please Log in to join the conversation.

  • keithgoldstein
  • keithgoldstein's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 months 2 weeks ago #255714 by keithgoldstein
Thank you both. You have taught me how to properly use the array function. I attach the example here for others who might need to see the example:

File Attachment:

File Name: limesurvey...2741.lss
File Size:47 KB
 

I didn't quite yet figure out how to merge the free text with the list, but it seems that I just need to add  custom css to the template editor and reference that. I will figure that out or create another post if absolutely necessary.

Thanks again.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 2 weeks ago #255729 by Joffm
Hi,

You have taught me how to properly use the array function

no, the manual tells you 
[url] manual.limesurvey.org/Question_type_-_Li...r_.28array_filter.29 [/url]

You see, this "workaround" with a hidden multiple question is only used if you have special requirements, like
only show items of an array that were rated >4
.

Well,
here a sample with both solutions I showed.
 

File Attachment:

File Name: limesurvey...7191.lss
File Size:147 KB


Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose