Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Filter answers based on previous question/Answer Logic

Filter answers based on previous question/Answer Logic 7 months 2 weeks ago #102611

  • andyb
  • andyb's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Hey everyone,

New LimeSurvey user. Picking it up quite quickly but I am having some issues dealing with logic and routing. I'd like to throw a couple of questions at you.

[One]
The first question asks the respondent to pick any options that apply.

Eg
Which flavours do you enjoy?
Chocolate
Strawberry
Vanilla
Banana

If the user picks multiple options (ie, more than 1), I'd like the next question to provide a single choice only of the options previously selected

Eg
Which one do you enjoy MOST?
Chocolate
Vanilla


[Two]
Another question would present the respondent with a list of options and is single choice only.

Eg
Which is your favourite colour?
Black
White
Red
Blue
Green

The second question should then populate the same answers, but exclude the option selected.

Eg User selects black
Which is your least favourite colour?
White
Red
Blue
Green


[Three]
I get question logic. Is it possible to include an answer in a question based on a previous response?

Eg
How do you get to work?
Train
Bus
Car <--- only include this if respondent previously indicated owning a car.
Walk


Thanks for the help!
Andy
The administrator has disabled public write access.

Filter answers based on previous question/Answer Logic 7 months 2 weeks ago #102614

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Please refer to the manual:

Relevance (to show a question if more than one option in a previous question selected) - manual.limesurvey.org/Expression_Manager...ation.2FBranching.29

Array filter - manual.limesurvey.org/Question_type_-_Li...r_.28array_filter.29

Array exclusion filter - manual.limesurvey.org/Question_type_-_Li...ay_filter_exclude.29

Regarding [Three], you will need to use JavaScript to show/hide that response.
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.

Filter answers based on previous question/Answer Logic 7 months 2 weeks ago #102617

  • andyb
  • andyb's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Tony

Thanks for the fast response.

I'm having some issues with the array filters, but I'll keep playing around for now.

As for the third,JavaScript isn't something I'm comfortable with. One workaround for me will be just to set up two separate questions. The first has all the options, and second has all options except the one with is conditional. Then I can just use a logic statement to route them as necessary.
The administrator has disabled public write access.

Filter answers based on previous question/Answer Logic 7 months 2 weeks ago #102620

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Sure, that would work.
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.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103358

  • andyb
  • andyb's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Hi Again,

Thanks for your help on this. I'm still having trouble with one of the scenarios and despite weeks of testing and trying I simply cannot get this working properly. Have looked at the manual and I seem to be doing everything correctly.

In my survey, C1 is a radio list of options:

C1 - What is your favourite?

6 options are given.

C2 is then a radio list of the same options, which is supposed to give the same options but exclude the one chosen in C1.

C2 - And which is your least favourite?

5 remaining options given.

That I'm aware, I'm supposed to be setting up an exclusion filter on C2. This does nothing but excludes EVERYTHING, meaning there's nothing for the user to select.

I'm 99% sure I'm doing this correctly. Happy to provide screenshots if wanted. Any help appreciated :)
Last Edit: 6 months 2 weeks ago by andyb. Reason: Clarification
The administrator has disabled public write access.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103359

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Are the answer codes for the two questions identical?

If so, can you attach a small sample survey with those questions?
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.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103362

  • andyb
  • andyb's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
I've attached the survey here for you, thanks.


File Attachment:

File Name: limesurvey_survey_952944.lss
File Size: 0 KB
The administrator has disabled public write access.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103374

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
That file is corrupted, all it contains is "XMLWriter class not compiled into PHP, please contact your system administrator".
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.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103555

  • MarcellavZ
  • MarcellavZ's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 13
  • Karma: 0
Hello!

I have a similar question as the question ascribed above. I want to use the asnwers of multiple previous questions (list: radio) as the answer possibilities of a next question. So the participants need to choose one of their previous answers in one question. There are 5 different questions with 5 different codes and the question where all the answers need to be set has also a differen code. I tried the solution you ascribed on the forum but that didn't work. Than I tried the solutions ascribed in the manual at 'array filter' and 'array exclusion filter' but than nothing is excluded. I get all the answers of all the previous questions. What am I doing wrong? The questions I want to filter are in a different questiongroup than the question where the answers needs to be set, so is that what makes it going wrong?

I hope you can shed some light on the situation for me. Thanks!
The administrator has disabled public write access.

Filter answers based on previous question/Answer Logic 6 months 2 weeks ago #103556

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
Tricky because the filter question(s) need to be multiple-choice and, if there are several, the option must be checked in all of them to be shown in the filtered question.

If all of your filter questions (list-radios) are in the same group you can add a multiple-choice question to that group and then use JavaScript to hide the multiple-choice and check its options depending on the radio answers. This hidden question would become the filter question.

You should be able to find several examples in the forums of similar workarounds.

.
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.
Last Edit: 6 months 2 weeks ago by tpartner.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.133 seconds
Donation Image