This script allows participants to see Choice question answers in the same randomized or rotated order in a follow-up Choice question's answers. Here, "Choice question" refers to the following question types:
- Single Choice
- Multiple Choice
The first Choice question will be referred to as the Original question/page. The follow-up Choice question that will be re-ordered according to the original will be referred to as the Follower.
Detailed Steps
-
In your survey, create the Original Choice question.
- From the Show answers in list, select Random order or Rotated order.
- Pin the answers you do not want to randomize or rotate.
Beside the answer option, click the options menu and select Pin answer.
-
Following the Original Choice question, on a new survey page, create a Short Answer Order question to store the order of the list.
- Hide the Short Answer Order question.
-
Following the Short Answer Order question, on a new survey page, create the Follower Choice question.
You do not have to set this question to randomize or rotate answers. - Open the Page element that contains the Original Choice question for editing and click the Scripting button.
- Copy and paste the first script into the On Load tab.
- Change ORIGINAL to the name of your Original question.
- Change ORDER to the name of your Order question.
- Click Save.
- Open the Page element that contains the Follower Choice question for editing and click the Scripting button.
- Copy and paste the second script into the On Load tab.
- Change ORDERSTORAGE to the name of your Order question.
- Change FOLLOW to the name of your Follower question.
- Click Save.
- Preview and test your survey.
- Repeat steps 9 to 13 to maintain randomization or rotation order across subsequent Follower Choice questions.
First Script
/*
Script Name: How do I maintain randomization or rotation order going from Choice answers to Choice answers? (Modern Surveys) (First Script)
To ensure your script works as expected, always copy the original script from the Script Library
found in the Alida Help Center. Failure to use the latest script from the script library may
cause unexpected results.
*/
const qOriginal = page.getElement('ORIGINAL');
const order = qOriginal.reorderElements([]);
const qOrder = response.getDataPoint('ORDERSTORAGE');
qOrder.set(JSON.stringify(order))
Second Script
/*
Script Name: How do I maintain randomization or rotation order going from Choice answers to Choice answers? (Modern Surveys) (Second Script)
To ensure your script works as expected, always copy the original script from the Script Library found in the Alida Help Center. Failure to use the latest script from the script library may cause unexpected results.
*/
const qOrder= response.getDataPoint('ORDERSTORAGE');
const order = qOrder.get();
const qFollow= page.getElement('FOLLOW');
qFollow.reorderElements(JSON.parse(order));
Example
Sample survey structure:
Original Multiple Choice question with randomized answers and 1 pinned other-specify answer:
Follow-up Multiple Choice question with randomized order maintained:
Comments
0 comments
Article is closed for comments.