Overview
This article will show you how you can display answers in a different order than the original list order the answers are in the designer.
Display Answers in a sorted order:
You can choose to display the answers in alphabetic order of the answers texts, using a function called SortAnswers(inQuesIdx):
I have a question containing these answers:
To display these answers in an alphabetic order, write this function in the question's Start Script:
When running the survey, the answers in this question will be displayed like this:
If you want to display the answers in descending order, add "true" as a second parameter to the function, like this:
Randomize answers order
You can display the answers in some undetermined randomized order. You can achieve this in two ways:
1. Go to the question's Advanced tab and enable the "Randomized answers/topics order" check box:
2. Use the RandomizeAnswers(inQuesIdx) function in the question's Start Script:
Randomize answers order according to a pre-defined array
You can set the displayed answers order according to array containing all possible answers indexes in a certain order.
For example, let's go back to this question, that contain these 6 answers:
We want to the answers to be displayed in this order (the numbers represent the answers indexes): 4, 6, 1, 2, 5, 3
We can create an array containing these indexes in this specific order, and use that array to randomize the answers, like this code in the question's Start Script:
And so, the answers will be displayed according to the indexes order in the array, like this:
A more detailed description on setting the order of Answers in a given order can be found in the following short guide: How To randomize answers in a given order
Visit us at:
Comments
Please sign in to leave a comment.