Welcome to the LimeSurvey Community Forum

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

Multiple Questions into one Array Filter

  • tinman30
  • tinman30's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 10 months ago #225109 by tinman30
Please help us help you and fill where relevant:
Your LimeSurvey version: [Version 3.27.20+211012]

==================
Long time listener, first time caller...

I am attempting to leverage 2 multiple choice questions (Q1 and Q2) and use the Array Filter to ask a third question (Q3 - using Array(Texts) numbers only).  In the Array Filter box in Q3 logic tab, I have "Q1; Q2". And my subquestion codes match.  My issue:  In Q3, the Q1 answers display properly (i.e. only when selected in Q1), but the Q2 answers display at all times (whether checked or unchecked).

Any idea what I am missing?  

Thanks in advance...

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 10 months ago - 2 years 10 months ago #225110 by Joffm
Replied by Joffm on topic Multiple Questions into one Array Filter
No, no idea.
Because you did not show us what you did.
So please, send an lss export of these questions.
Copy the survey, remove everything not related to your problem and export as lss.

Everything else is pure guessing.
And I guess that you did not set the subquestion codes correctly.


Joffm

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

Please Log in to join the conversation.

More
1 month 5 days ago #268009 by percyherrera
Replied by percyherrera on topic Multiple Questions into one Array Filter
I'm having the same issue with the 'Array filter' when it's combined with multiple questions. Even though I'm separating the questions with a semicolon (;), I'm not getting the expected result. I'm sharing my *.lss survey file so you can help me figure out what I'm missing.


Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 4 days ago #268022 by holch
Replied by holch on topic Multiple Questions into one Array Filter
What is the expected result?

Because the array filter from P2 based on P1 works, and from P3 based on P2 and P1 also works.

What I don't understand is why P4 is not showing at the moment.

But please explain what you are trying to do. Because in P2 and P3 you use the Array Exclusion filter and in P4 you use the "normal" array filter.

My guess is, that the array filter can't cope with two questions having repeated subquestion codes. Because to join them, you would need to make sure that the answer/subquestion codes in the different question you base the filter is on are different.

Because otherwise the different questions level each other out.

E.g. as you have the code 1 in p1 and also in p2, this might confuse the array filter. For the array exclusion filter this isn't really relevant. So you should tell us what you are trying to do, because with the generic naming you are using it is not understandable what you are trying to do.

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.

More
1 month 4 days ago #268026 by percyherrera
Replied by percyherrera on topic Multiple Questions into one Array Filter
Thank you for your dear interest.
You're right, I sent a version of the survey with more questions and maybe that was confusing.
I explain myself better in p1, I have 3 brands and the user must select the one they remember first (only 1 answer). The same alternatives should be shown on p2 except the one marked on p1.
In p3 the options marked in p1 and p2 are expected to be displayed, but I do not get this result.
In this scenario it is important that the code of each alternative is respected and maintained.
I share the updated version of my survey.


Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 days ago #268027 by Joffm
Replied by Joffm on topic Multiple Questions into one Array Filter
Easiest:
Use the array exclusion filter in p2.
In p3 display by subquestion relevance.

Joffm 

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

Please Log in to join the conversation.

More
1 month 3 days ago #268028 by percyherrera
Replied by percyherrera on topic Multiple Questions into one Array Filter
thanks for your response. Could you give me an example or a link to take as a reference and do the tests?

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 days ago - 1 month 3 days ago #268029 by holch
Replied by holch on topic Multiple Questions into one Array Filter
Well, LS is doing in p3 exactly what you are asking it to do, at least in the first LSS file that you have provided. 


In p3 you used the array exclusion filter based on p1 and p2. So what does LS do? It hides in p3 thos answers, that have been chosen in p1 and p2.Here is the tool tip that explains what the "array exclusion filter" does:

What you want is the "normal" array filter I guess. For the "normal" aray filter it shows only those answers, that have been chosen in the previous questions you base your array filter on.However, I think you will run into trouble with what you are trying to do, because you use two questions with the same question codes (p1 and p2) in your array filter. If you will look a the logic file of p3 if you switch to the normal array filter you will see this: 
 

What happens there? LS checks for p3_1, so the answer "uno" if p2_1 is NOT empty AND p2_2 is also NOT empty. But due to your array filter exclusion used in p2, this must always be untrue. Because in the p2 you always hide the answers that were marked in p1, so they are always empty.So your are blocking yourself with these nested array filters.But, as due to the question type you are using, you do not need to use the array filters, but you can apply relevance equations / conditiosn to each subquestion individually which will allow you to do what you want to do (show and hide subquestions/answer options) based on your idea without having the interfearance of the differen array filters on each other.In p2 you simply check if the answer was chosen in p1 and then you hide the respective subquestion. In p3 you do somehow the opposite. You check if the answer option was chosen in p1 OR p2 and if so, you show it, if not you hide it.

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

Last edit: 1 month 3 days ago by holch.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 days ago #268031 by Joffm
Replied by Joffm on topic Multiple Questions into one Array Filter

=1emCould you give me an example or a link to take as a reference and do the tests?

Well, these basics like
"conditions"  - on group level and question level
"relevance equation" - as it is still called on subquestion level
you have to learn.
Just read the manual and study the sample surveys.
[url] www.limesurvey.org/manual/ExpressionScript_sample_surveys [/url]

A relevance equation is just a logical term that can be TRUE or FALSE.
If TRUE, the group / question / subquestion is displayed, if FALSE it is not displayed.

Now, when is p3_1 displayed?
When either p1_1 is selected or p2_1 is selected.
I hope you know that in "multiple" question "Y" is stored, if selected, else "" (blank)

So this condition is nothimg else than
p1_1=="Y" or P2_1=="Y" - one of them was selected.
Now one addition.
Because p2_1 may not have been displayed, this condition will fail, because it is not defined.
Therefore you have to add ".NAOK"
[url] www.limesurvey.org/manual/ExpressionScri...ion/en#Usage_of_NAOK [/url]

Meaning, finally the subquestion relevance of p3_1 will be
p1_1.NAOK=="Y" or p2_1.NAOK=="Y"
The other subquestions analogue.

Or you could use a slightly different approach
p3_1 is displayed, if the count of selected items in p1_1 and p2_1 is greater than 0
So you could use
count(p1_1.NAOK,p2_1.NAOK)>0

About the function "count()" and all other implemented functions read the manual
[url] www.limesurvey.org/manual/ExpressionScri...mplemented_functions [/url]

Joffm


 

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

Please Log in to join the conversation.

More
1 month 3 days ago - 1 month 3 days ago #268033 by percyherrera
Replied by percyherrera on topic Multiple Questions into one Array Filter
I'm still having trouble with my question 3 (p3). I have followed the instructions and I can only display the selected options on p1. If I put "p1;p2" in the "Array filter" field, nothing is displayed. I don't know what I'm missing. Please help.

Last edit: 1 month 3 days ago by percyherrera.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 3 days ago #268035 by Joffm
Replied by Joffm on topic Multiple Questions into one Array Filter

Meaning, finally the subquestion relevance of p3_1 will be

I always talked about "subquestion relevance", not a condition of the question.
You want to display (or not) subquestions, not the entire question.
 
 

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

Please Log in to join the conversation.

More
1 month 3 days ago #268036 by percyherrera
Replied by percyherrera on topic Multiple Questions into one Array Filter
It's finally out, I'm going to cry with happiness.
By writing the condition in the "relevance equation" field I finally got the expected result. 
Thank you so much @Joffm







Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose