Array filter
Once you have completed the main steps, you will need to modify the parameters in the provided template snippet to apply the changes.
Using array filter in a matrix question will require you to disable the required parameter in order to delegate validation to this survey code.
question_code
The single choice matrix question code you want to configure.
single_choice_matrix({
    question_code: "Q3"
});
array_filter
Here we define settings for array filter. If not needed, just remove this entire block code and skip this tutorial ๐
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        
    }
});
array_filter -> rows
Here we define the array filter for rows in the matrix. If not needed, just remove this entire block code.
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        rows: {
            
        }
    }
});
array_filter -> rows -> filter
This variable specifies the question code of a filter where selected options will be taken, usually a single or multiple choice.
โน๏ธ Only checked options in filter question will be validated. 
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        rows: {
            filter: "Q0"
        }
    }
});
array_filter -> rows -> filter_schema
This variable is the filter's schema, it tells the randomization process what answer codes appeared in filter question. 
โน๏ธ Only answer codes within filter_schema will be filtered out if they were checked. If not, they will be ignored.
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        rows: {
            filter: "Q0",
            filter_schema: "Q0xSCHEMA"
        }
    }
});
array_filter -> rows -> type
This variable defines the type of filtering, it can be:
inclusive, to keep rows based on what was selected in filter.
exclusive, to remove rows based on what was selected in filter.
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        rows: {
            filter: "Q0",
            filter_schema: "Q0xSCHEMA",
            type: "exclusive"
        }
    }
});
array_filter -> columns
Here we define the array filter for columns in the matrix. If not needed, just remove this entire block code.
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        columns: {
        }
    }
});
array_filter -> columns -> filter
This variable specifies the question code of a filter where selected options will be taken, usually a single or multiple choice.
โน๏ธ Only checked options in filter question will be validated. 
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        columns: {
            filter: "Q0"
        }
    }
});
array_filter -> columns -> filter_schema
This variable is the filter's schema, it tells the randomization process what answer codes appeared in filter question. 
โน๏ธ Only answer codes within filter_schema will be filtered out if they were checked. If not, they will be ignored.
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        columns: {
            filter: "Q0",
            filter_schema: "Q0xSCHEMA",
        }
    }
});
array_filter -> columns -> type
This variable defines the type of filtering, it can be:
inclusive, to keep columns based on what was selected in filter.
exclusive, to remove columns based on what was selected in filter. 
single_choice_matrix({
    question_code: "Q3",
    array_filter: {
        columns: {
            filter: "Q0",
            filter_schema: "Q0xSCHEMA",
            type: "inclusive"
        }
    }
});
Last updated
Was this helpful?