Welcome to the LimeSurvey Community Forum

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

usage of Multiple array_filter feature

  • scampo02
  • scampo02's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #106646 by scampo02
usage of Multiple array_filter feature was created by scampo02
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 topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #106648 by holch
Replied by holch on topic usage of Multiple array_filter feature
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.

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

The topic has been locked.
  • scampo02
  • scampo02's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #106651 by scampo02
Replied by scampo02 on topic usage of Multiple array_filter feature
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 topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 11 months ago #106660 by tpartner
Replied by tpartner on topic usage of Multiple array_filter feature
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.
The topic has been locked.
  • scampo02
  • scampo02's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 11 months ago #106690 by scampo02
Replied by scampo02 on topic usage of Multiple array_filter feature
Thank you very much. That's what I was looking for !!!

I really appreciate your help
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose