Tip: Are you using scripting with power surveys to pipe/hide/mask answer options from one question to another question? You can now do this in surveys with no need for scripting. For more information, see Carry Forward Answers in the Surveys documentation.
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 the previous question. The question that will be masked will be referred to as the masking question.
This script will work in following question types:
- Allocation Grid to Grid Question - Columns
Previous Question Type | Masking Question Type |
|
|
Example
Show in Q2 the activities that a respondent spends only 0-20% of the time per day in Q1.
Q1 Example
Q2 Example
Detailed Steps
Note: Ensure that the options in the Previous question and the Masking question have the same number of items and are in the same order.
- Copy the script of appropriate case from below.
- Select the masking question in the Questionnaire Tree.
- In the Scripting section of the masking question, click Edit Scripts.
- Paste the script into the On Load tab.
- Change Q_MASKING to the name of your masking question/page.
- Change Q_PREVIOUS to the name of your previous question.
- Change min to the lowest number for each slider range you would like to show in the masking question.
Note: When a value isn't selected for an item in an Allocation Slider question the default value is 0. - Change max to the highest number for each slider range you would like to show in the masking question.
- Change -1 to item numbers you would like to show all the time (separated by a comma if there are multiple). E.g. 'None of these' option. If you do not have any items to show permanently, leave it as is.
Note: the item number represents the position of the item, it is not the precode. - Click Save.
- Validate and test your survey.
Script
ShowColumns (Q_MASKING, ArrayUnion(GetAllocRowsIfBetween(Q_PREVIOUS, min, max), new int[] {-1}));
Use Case Example Syntax
ShowColumns (Q2, ArrayUnion(GetAllocRowsIfBetween(Q1, 0, 20), new int[] {6}));
Comments
0 comments
Article is closed for comments.