aytm Logic: Sort by array
Preserve the sort order of items across questions or subquestions using a combination of Sort logic and Array logic. In this way, you can randomize a list of items across respondents, while preserving the order within a single respondent's survey.
1. Create a reference array
In any question that appears before the list of items, add array logic, including the item numbers of all answer options or subquestions you would like to randomize. Note that you must write out all numbers you'd like to include separated by commas (rather than using a range). In this example, the word activities is the name of our array that we will use as a reference in later logic. Give your array a name that makes sense to your list of items. Ex: [activities << 1,2,3,4,5,6,7,8,9,10,11,12,13] |
Learn more about arrays.
2. Add the shuffle command
In order to randomize the list (per respondent) we'll also randomize the order of the numbers that were added to the array. We can accomplish this by using the array name, and the shuffle command. This command must come after the array is created, and before the array is used in other logic. Ex: [activities = shuffle activities] |
3. Use Sort by logic
Within the question text of the desired question, add Sort by logic, where the reference is the question and list you wish to sort, and the order to sort is the (previously shuffled) array name. If the list is a set of answer choices, use the reference A; if the list is a set of sub-questions such as within a matrix question, use the reference SQ. This will tell the system to enforce the shuffled order within the question referenced. Ex: [Sort Q2A by activities]
|
4. General notes and reminders
As you sort by array, keep in mind:
|