Preserve the sort order of items across questions or subquestions using a combination of Sort logic and Array logic. This lets you randomize a list of items across respondents while preserving the order within a single respondent's survey.
Creating 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 to randomize. All numbers must be written out individually separated by commas — ranges are not supported here.
In this example, activities is the array name used as a reference in later logic. Give your array a name that reflects your list of items.
[activities << 1,2,3,4,5,6,7,8,9,10,11,12,13]
Learn more about arrays.
Adding the Shuffle Command
To randomize the list per respondent, shuffle the order of the numbers in the array. This command must come after the array is created and before it's used in other logic.
[activities = shuffle activities]
Using Sort By Logic
In the question text of the question you want sorted, add Sort by logic referencing the question and the (previously shuffled) array. Use A for answer choices, or SQ for subquestions (e.g. within a matrix question). This enforces the shuffled order within the referenced question.
[Sort Q2A by activities] [Sort Q3SQ by activities]
Notes and Reminders
- This logic will not work if the Randomize checkbox is enabled on the question type.
- This logic may be used in conjunction with Mask logic.
- If your array doesn't include all answer options, the omitted items will appear in static order after the shuffled list. For example, if your logic is
[brands << 1,2,4,5,6] [brands = shuffle brands]and there are 8 answer options, respondents will see A1, A2, A4, A5, and A6 in a random order, followed by A3, A7, and A8 in their original order.