The order tags article covers basic usage of the order
tag, and this article provides additional examples of shorthand notations with the order
tag.
See Advanced examples with the order tag for applying explicit order strings and using independent variables.
Additional examples
Randomizing all options and anchoring options at the end
Use the '$' sign to anchor the final option in a list while randomizing the others. Alternatively, use the anchor: y
decorator with the order
tag, as shown in Q6A. Both methods achieve the same result.
6. Which of the following colors is your favorite?
type: radio
order: [*],$
1. Blue
2. Green
3. Red
4. Orange
5. Yellow
97. Other {autoother: y; size: 10}
6A. Which of the following colors is your favorite?
type: radio
order: [*]
1. Blue
2. Green
3. Red
4. Orange
5. Yellow
97. Other {autoother: y; size: 10} {anchor: y}
Randomizing all options and anchoring options at the beginning
Use the '^' sign to anchor the first option in a list while randomizing the others. Alternatively, use the anchor: y
decorator with the order
tag, as shown in Q6C. Both methods achieve the same result.
6B. Which of the following colors is your favorite?
type: radio
order: ^,[*]
97. Other {autoother: y; size: 10}
1. Blue
2. Green
3. Red
4. Orange
5. Yellow
6C. Which of the following colors is your favorite?
type: radio
order: [*]
97. Other {autoother: y; size: 10} {anchor: y}
1. Blue
2. Green
3. Red
4. Orange
5. Yellow
Ordering a sheet
The order
tag can be used on a define sheet
widget to set the order for a sheet for the entire survey or added to a list call to apply it to a single question.
In the example below, the define sheet
widget applies a randomized order to the 'countries' sheet. Wherever this sheet is used, such as in Q1A, the specified order applies. However, in Q1B, the order
tag is applied at the question-level, so randomization is only applied to the 'food' sheet in this specific instance.
define sheet: surveyID.countries
order:[*]
1A. What is your favorite country?
type: radio
optsfrom: surveyID.countries
1B. What is your favorite food?
type: radio
optsfrom: surveyID.food
order:[*]
Randomizing the starting point of a sequential order
Using order: <*>
selects a random starting point in a list and then follows the list in sequential order.
3A. Please select your favorite letter of the alphabet.
type: radio
order:<*>
1. A
2. B
3. C
4. D
5. E
6. F
7. G
Randomizing the starting point and anchoring options at the end
Building on the previous example, you can randomize a starting point while anchoring specific options at the end by specifying their positions. For example, the final option is always anchored with a dollar sign '$', the one before it with '$-1', and so on. In the example below, options 8 and 99 are added and will always be anchored at the end of the list.
3B. Please select your favorite letter of the alphabet.
type: radio
order:<*>,$-1,$
1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. Z
99. None of these
The anchor: y
decorator could also be used with order: <*>
to anchor the last two options in place.
Randomizing the starting point and anchoring options at the beginning
You can randomize a list while still anchoring specific options at the beginning by specifying their positions. Whereas the final list option is anchored with a '$', with preceding options specified by subtracting from it (e.g., '$-1', '$-2', etc.), the first option is anchored with a carat, '^', and subsequent options are specified by adding to it (e.g., '^+1', '^+2', etc.).
In the example below, Q8 is fully randomized except for the first two anchored options.
8. Which of the following fruits is your favorite?
type: radio
order: ^,^+1,[*]
1. Apples
2. Oranges
3. Pears
4. Plums
5. Bananas
6. Strawberries
7. Peaches
Randomizing the starting point of alphabetized options
Using order: AtoZ<*>
selects a random starting point in an alphabetized list and then follows the list in alphabetical order.
5. Please select one.
type: radio
order: AtoZ<*>
1. time
2. person
3. year
4. way
5. day
6. thing
7. man
8. world
9. life
Comments
0 comments
Please sign in to leave a comment.