QS:Array filter
From LimeSurvey Manual
Array filter (array_filter)
Description
The Array filter advanced settings allow you to use any multiple choice question to select or set which responses display in a subsequent list, array or multiple choice question.
- Multiple choice
- Multiple choice with comments
- Multiple short text
- Multiple numeric
- Array (5 point, 10 point, Yes/No/Unknown, Increase/Same/Decrease, Column)
- Array (Dual Scale, Text, Numbers)
- Ranking
Furthermore, each of these types of questions can filtered.
The only exception is Array (Column), which can filter other questions, but can not itself be filtered.To set a filter
Enter the question code of a multiple options question to use as the source information into the setting for array filter. For example, if your source multiple option question code is "Q1" enter "Q1" into either the 'Array Filter' input or the 'Array Filter Exclusion' input in the advanced settings of the question you want to filter. Only answer options that are selected in question Q1 will be visible in the array_filter-ed question.
Array filter question settings require the questions being used to have exactly matching lists of answers. If the questions do not have exactly the same set of answers and codes, then the filters will break.
Cascading
The Array filter will cascade – that is you can select a question which filters another question, which filters another question, and so on.
Array filter example
Ticking items ‘One’, ‘Three’ and ‘Four’ in the first question results in the entries 'One', 'Three' and 'Four' displaying in the subsequent question which uses array filter
Multi option question
Code:Q1
Question: Which animals do you like?
1 Cat
2 Dog
3 Zebra
Array 5 Point Choice Question
Code:Q2
Question: Rate these animals on a scale of 1 to 5, where 1 is I like them a little and 5 is I like them a lot
Array filter example 2 - Using Multiple Short Text
Here is the LimeSurvey Group file for the above demo
Array filter example 3 - Cascading Array Filters
This sample survey shows use of array_filter, array_filter_exclude, and exclude_all_others, plus cascading array filters.
ls2_cascading_array_filter.lss