This script works in conjunction with a masking script and the in-question mask functionality. This script will make a follow-up question to skip and auto-punch if only one option was to be shown to the participant.
Example
A screener question asks a participant to indicate which brands they commonly purchase. A follow-up to a screen asks the participant to choose their favorite from among the brands. If the participant chose only one brand in the screener question, asking them to choose their favorite makes no sense.
This script will work in following question types:
- Single Choice Questions (standard and visual)
- Multi Choice Questions (standard and visual)
- Allocation Grids
- Allocation Sliders
If you haven't placed a pipe / mask script on the follow-up question yet, please follow instructions on the links further below before proceeding.
Detailed Steps
- Add a Multi Choice screener question.
- Add your follow-up question. It could be a Choice question or an Allocation question.
- Copy the script of appropriate case from below into Notepad or any other Text editor.
- Change Q_FOLLOWUP to the name of your follow-up question.
- Select the follow-up question in the Questionnaire Tree.
- In the Scripting section of the question, click Edit Scripts.
- Paste the script into the On Load tab.
- Click Save.
- Validate and test your survey.
Case | Script |
---|---|
To auto-punch a single/multi choice question |
SetAndSkipIfOneItemShown(Q_FOLLOWUP);
|
To auto-punch an allocation grid/slider Note that the auto-punched value will either be what's specified in the question property "Maximum Total" or the maximum value specified by a script such as this. |
SetAndSkipIfOneItemShown(Q_FOLLOWUP, Q_FOLLOWUP.MaximumAllocatable); |
Example
Case | Script |
---|---|
Show selected options from Q1 (multi-choice) on Q2 (single-choice). If only one item is to show on Q2, auto-punch the option and skip. |
Show(Q2, ArrayUnion(GetSelectedIndexes(Q1), new int[] {-1}));
SetAndSkipIfOneItemShown(Q2);
|
Show selected options from Q1 (multi-choice) on Q2 (allocation). If only one item is to show on Q2, auto-punch 100 to the option and skip. Provided that Q2 has "Maximum Total" in the properties as 100. |
Show(Q2, ArrayUnion(GetSelectedIndexes(Q1), new int[] {-1})); SetAndSkipIfOneItemShown(Q2, Q2.MaximumAllocatable); |
Comments
0 comments
Article is closed for comments.