Welcome to the LimeSurvey Community Forum

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

Show/hide answer choices based on answer(s) to previous questions

  • bflow-unb
  • bflow-unb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 4 days ago - 1 week 4 days ago #263425 by bflow-unb
Your LimeSurvey version: 6.4.1+240108
Own server or LimeSurvey hosting: Own server
Survey theme/template: Default
==================

I've been asked to setup a survey with some esoteric logic/branching and I'm not sure if its even possible. Something like this:

Question 1 (multiple choice, single answer)
  • Choice A
  • Choice B
Question 2 (multiple choice, single answer)
  • Choice A
  • Choice B
Question 3 (multiple choice)
  • Choice A  (only show if answer to Q1 was A and answer to Q2 was A )
  • Choice B ( only show if answer to Q1 was A and answer to Q2 was B )
  • Choice C  (show for any answer to Q1 or Q2)
  • Choice D ( only show if answer to Q1 was B and any answer to Q2 )
  • Choice E ( only show if answer to Q1 was B and answer to Q2 was B )
Can this be done?
Last edit: 1 week 4 days ago by bflow-unb.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 4 days ago #263428 by Joffm
Hi,
at first:
Read the manual to get familiar with question types and their settings and ExpressionScript.

What you want to achieve is really basic.
You use relevance equation of subquestions

You know a relevance equation is a logical term that can be TRUE or FALSE.
If TRUE the subquestion is displayed, if FALSE it is not displayed (questions / groups analogue)

Now what are your equations?
1: Q1 was A and answer to Q2 was A -> Q1==your code of Choice A AND Q2==your code of Choice A
2: Q1 was A and answer to Q2 was B -> Q1==your code of Choice A AND Q2==your code of Choice B
4: Q1 was B and any answer to Q2 -> Q1==your code of Choice B
...

Joffm

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

Please Log in to join the conversation.

  • bflow-unb
  • bflow-unb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 3 days ago #263443 by bflow-unb
Thank you so much. That has got me started on the right track!

I note that I have to make the third question an Array (as oppose to a normal multiple choice) in order of have a Relevance equation for each answer. This does look like it can work for me. As an example I'm using ((G01Q01.NAOK == "AO01")) as a condition for certain subquestions and indeed they show/hide as expected (based on what was selected as the answer for question Q01)!

The only issue I'm running into now is that the Array allows a person to make more than one choice which we dont want them to do. If I set Maximum answers to 1, it still lets them select more than one and they just get a warning "Please select at most one answer" (and at that point wont let them unselect previously selected ones).

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 3 days ago #263446 by Joffm
Hi,
obviously you use the wrong question type.
Please, send the lss export of your survey (if it is  very long, only the relevant questions)

Joffm 

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

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 3 days ago #263450 by holch
Your request gives the impression that the first questions are single punch and the 3rd is multipunch, not an array / matrix. So that's what Joffm gave the answer for.

As Joffm says, if it ain't so, show us what the actual survey looks like (only the 3 relevant questions) by providing a LSS file (not LSQ or LSG). Make a copy of your survey, throw everything out that isn't relevant for the issue and export it as LSS.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • bflow-unb
  • bflow-unb's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 3 days ago #263455 by bflow-unb
I've attached a simplified version of what I'm working on.

We want everything to be single punch and ideally Question 3 should only show certain options based on what was chosen for an answer in Questions 1 and 2.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #263486 by holch
OK, all Single Punch requires a little workaround, because there is no such thing as answer option relevance, like there is subquestion relevance.

So you have a couple of options:

1. Quick and dirty: Use a multipunch question and limit the number of responses to 1. Works like a single punch question this way, can use subquestion relevance. But it still looks like a multipunch question with the checkboxes compared to the radio buttons of single punch questions.

2. use a hidden multipunch question to "collect" the answers from the two single punch questions and use the array filter to show/hide the respective answers in the last single punch question.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #263487 by holch
However, looking at your LSS file, I probably would rather create two questions for the academic background part, one for campus A, another for campus B. It is the easiest and in my opinion cleanest way.

Also, G01Q02 seems to be completely irrelevant for this issue, or am I missing something?

But here an example:

You'll create a mutlipunch question that you will hide later, to be able to use relevance equation for the items. So via expression you "tick" the boxes in this multipunch question based on whether respondents have chosen location A or B.

Then you create a single punch question with exactly the same items and exactly the same answer codes as the subquestion codes in the previous question and set an Array filter on the previous question.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 week 2 days ago #263488 by holch
Here a working example (with some issues that I really don't understand, need to do more research),

1. First I put the equation in the question text of the multipunch question. This worked, with the array filter, but the subquestions were not ticke.
2. Then seperated it into an equation question in the first question group and now ALL subquestions were ticked always and the array filter would also show all answer options in the last single punch question (which is corretly wrong).
3. Then I moved the equation question into the second group and now all subquestions are still ticked, but the array filter now wrongly works correctly... lol

So it works, but with some odd behaviour. Maybe someone eles understands why? Maybe a bug in Limesurvey? Because I should be able to "tick" the answers of the multipunch question correctly via equation. But it either shows all ticked or none ticked. Weird.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose