This script allows participants to see Grid question rows in the same randomized or rotated order in a follow-up Grid question's columns. Here, "Grid question" refers to the following question types:
- Single Choice Grid
- Multiple Choice Grid
The first Grid question will be referred to as the Original question/page. The follow-up Grid 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 Grid question.
- From the Show rows in or Show statements in list, select Random order or Rotated order.
- Pin the rows you do not want to randomize or rotate.
Beside the row option, click the options menu and select Pin row.
-
Following the Original Grid 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 Grid question.
You do not have to set this question to randomize or rotate columns. - Open the Page element that contains the Original Grid 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 ORDERSTORAGE to the name of your Order question.
- Click Save.
- Open the Page element that contains the Follower Grid 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 Grid questions.
First Script
/*
Script Name: How do I maintain randomization or rotation order going from Grid rows to Grid
columns? (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.elements[1].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 Grid rows to Grid
columns? (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 qOrder= response.getDataPoint('ORDERSTORAGE');
const order = qOrder.get();
const qFollow= page.getElement('FOLLOW');
qFollow.elements[0].reorderElements(JSON.parse(order));
Example
Sample survey structure:
Original Single Choice Grid question with randomized rows:
Follow-up Multiple Choice Grid question with columns that maintain the randomized row order:
Comments
0 comments
Article is closed for comments.