The terms pipe, hide and mask are used interchangeably. The common goal is to show options based on a previous question. We will use the word mask throughout this article.
The question which you would like to reference will be referred to as previous question. The question that will be masked will be referred to as masking question.
This script will work in following question types:
Previous Question Type | Masking Question Type |
|
|
Detailed Steps
- Copy the script of appropriate case from below.
- Select the masking question/page in the Questionnaire Tree.
- In the Scripting section of the masking question/page, click Edit Scripts.
- Paste the script into the On Load tab.
- Change Q_PREVIOUS to the name of your previous question.
- Change Q_MASKING to the name of your masking question/page.
- Change # to item numbers that need to be selected in the previous question. (separated by a comma if there are multiple).
- Change #,#,# to item numbers that need to show in masking question separated by a comma.
Note: that this item number list can be as short or as long as required. It must contain all items to show for the criteria specified in point 7. - If there are more than one logic, repeat step 5-8 given that item lists to reference from the previous question are Mutually Exclusive.
Note: the term Mutually Exclusive means that each item number for # can only appear once for entire script. i.e. across all IF statements. It also means that only one IF statement should be true at a time.
If multiple statements are true at a given time, masking may not work properly. - Click Save.
- Validate and test your survey.
Script
/*Script Name: How do I mask specific options/rows/columns/items based on a previous Choice question? (Power Surveys)
To ensure your script works as expected, always copy the original script from the script library found in the support portal. Failure to use the most up to date script from the script library may cause unexpected results.
*/
Case | Script |
Show specific options as answers or grid rows | if(AnySelected(Q_PREVIOUS, #)) Show(Q_MASKING, #,#,#); |
Show specific options as grid columns | if(AnySelected(Q_PREVIOUS, #)) ShowColumns(Q_MASKING, #,#,#); |
Example
if(AnySelected(Q1, 1,2)) Show(Q2, 1,2,3,6);
if(AnySelected(Q1, 3,4)) Show(Q2, 4,5,6);
Q1
Q2
Do you anticipate that there will be cases where participants are shown only one option as a result of masking?
The survey logic might end up forcing participants to select the only option or allocate 100% to the only option without any other choices (only in cases of masking question being a Single Choice question or an Allocation Grid). If you would like to skip the question and have the option auto-punched for this specific case, please follow further steps in this article to complete your script.
Comments
0 comments
Article is closed for comments.