Welcome, Guest
Username: Password: Remember me

TOPIC: usage of Multiple array_filter feature

usage of Multiple array_filter feature 6 months 4 weeks ago #106646

  • scampo02
  • scampo02's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Hello:

I'm new using limesurvey, so I have a question regarding array_filter/array_filter_exclude that I hope you can help me to answer.


I have a survey with 3 questions, each of them with 5 subquestions like this:

Q1. what FRUIT is your favorite ? (JUST SELECT one answer)

SQ001 LEMON
SQ002 ORANGE
SQ003 BANANAS
SQ004 STRAWBERRY
SQ005 BLUEBERRY

Q2. what other FRUITS are your favorite ? (on this question I used an array_filter_exclude to exclude the answer of Q1, and just leave the other fruits & it works perfectly)

SQ001 LEMON
SQ002 ORANGE
SQ003 BANANAS
SQ004 STRAWBERRY
SQ005 BLUEBERRY

Q3. Which of this fruits you use to prepare a flavored drink ? (on this question, the subquestions have to be all answers selected on Q1 & Q2, but when I try to use array_filter separated by a semicolon, i.e. Q1;Q2, it just shows the answers when they are selected on both questions, situation that is not possible because on Q2 just appears the answer that are not selected on Q1.)

SQ001 LEMON...
SQ002 ORANGE...
SQ003 BANANAS...
SQ004 STRAWBERRY...
SQ005 BLUEBERRY...


Anybody can help me to find out how to create this survey ? or if I need to make any programming in ordr to get that result ?
The administrator has disabled public write access.

usage of Multiple array_filter feature 6 months 4 weeks ago #106648

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2852
  • Thank you received: 359
  • Karma: 124
From what I know, the array filter only works with one specific question, not more.

So you can ask in one question about all the fruits they like and then filter Q3 this way.
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.

usage of Multiple array_filter feature 6 months 4 weeks ago #106651

  • scampo02
  • scampo02's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Thanks a lot holch, however in the manual says that I can put several questions separated by semicolon. I dit it and ion the logic put the following:


SQ-1 Q3_SQ001 (( ! is_empty(Q1_SQ001.NAOK)) && ( ! is_empty(Q2_SQ001.NAOK))) LEMON
SQ-2 Q3_SQ002 (( ! is_empty(Q1_SQ002.NAOK)) && ( ! is_empty(Q2_SQ002.NAOK))) ORANGE
SQ-3 Q3_SQ003 (( ! is_empty(Q1_SQ003.NAOK)) && ( ! is_empty(Q2_SQ003.NAOK))) BANANAS
SQ-4 Q3_SQ004 (( ! is_empty(Q1_SQ004.NAOK)) && ( ! is_empty(Q2_SQ004.NAOK))) STRAWBERRY
SQ-5 Q3_SQ005 (( ! is_empty(Q1_SQ005.NAOK)) && ( ! is_empty(Q2_SQ005.NAOK))) BLUEBERRY


Which I've tested that Q3_SQ001 will be shown only if Q1_SQ001 and Q2_SQ001 are not empty. Is there any way to change the && by || (or) ?
The administrator has disabled public write access.

usage of Multiple array_filter feature 6 months 4 weeks ago #106660

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4278
  • Thank you received: 807
  • Karma: 370
The array filter only applies if the options in all of the filter question are checked.

If using "group-by-group" mode and all of the questions are on the same page, you could insert a hidden checkbox question and use it as the filter for Q3.

Here is a post with a similar solution - www.limesurvey.org/en/forum/can-i-do-thi...ter-exclusion#101177.


.
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.

usage of Multiple array_filter feature 6 months 4 weeks ago #106690

  • scampo02
  • scampo02's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Thank you very much. That's what I was looking for !!!

I really appreciate your help
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.116 seconds
Donation Image