The order
tag specifies how options are arranged in a question or list. It can organize the options in random, sequential, reverse, alphabetical, or explicit order.
setlist: COLORS
order: [*]
1. Red
2. Orange
3. Yellow
4. Green
5. Blue
6. Purple
7. Pink
1. These colors are listed in random order.
type: radio
optsfrom: COLORS
Tip! In general, the term options refers to a set of answer choices in a question or on a standalone list (setlist). However, the same ordering rules apply to all list elements, including answer options, card sort and ranking items, as well as table rows and columns.
Details
- The
order
tag accepts either a comma-separated string to explicitly define each option's position (e.g.,order: 3,2,1
) or shorthand notations such as randomization withorder: [*]
. - When used at the list level with a
setlist
widget, the order applies to every question or table that uses the list. When applied inline at the question level, the order applies to the list elements for that question only. - If an order is set at the list level, it will carry over to other questions using the same list unless it is overridden on another widget.
- To override an existing list order consisting of a single list, apply the
order
tag directly to the question orsetlist
widget that calls the list. For an existing list order with multiple collections, use theflatorder
tag instead. - The
orderfrom
tag allows you to pull the order from a previous widget (question, table, list, etc.) and apply it to another one. - You can specify multiple ordering options within a single
order
tag by including 'or' in the input — e.g.,order: (*) or reverse(*)
. The system will then randomly select one of these ordering options for each respondent. - The
order
tag can be used as a decorator or as a column header in a spreadsheet to organize collections grouped by collection headers. - The
order
tag can be applied to adefine sheet
widget to apply an order to a sheet.
Explicit ordering
Explicit list ordering refers to the position of the options themselves, not the option IDs. This ordering depends on assigning a specific number to represent each element's position. In the examples below, consider the list MY_LIST as the reference for the order input.
set list: MY_LIST
1. Item 1
2. Item 2
3. Item 3
4. Item 4
Order input | Description |
order: (1,2,3,4) |
Use parentheses '( )' to keep a set of positions in a static order. Parentheses are not needed by default, as shown in the previous example. |
order: [1,2,3,4] |
Use square brackets '[ ]' around a set of option positions to randomize their order. |
order: <1,2,3,4> |
Use '< >' around a set of option positions to start at a random position and then continue in sequential order. |
order: [1,2,^3,4] |
Positions can be anchored anywhere in a list, even when other positions are shown in random order. To anchor a position, insert a caret '^' to the left of the position that should remain anchored. |
Note: If an option is missed in the explicit order definition, this could result in the option not being displayed.
Shorthand ordering
As mentioned above, the order
tag will accept a comma-separated string or shorthand notation. Below is a list of common shorthand inputs.
Order input | Meaning |
order: (*) |
Static order for all (non-randomized). |
order: [*] |
Randomize all. Equivalent to |
order: <*> |
Sequential order with a random starting point. |
order: AtoZ(*) |
Alphabetical order. Equivalent to |
order: AtoZ<*> |
Alphabetical order with a random starting point. |
order: ZtoA(*) |
Reverse alphabetical order. |
order: [*],$, $-1, $-2 |
Randomize all, but anchor option(s) starting at the end. Anchor the last option ('$'), the next to last option ('$-1'), the second to last option ('$-2'), and so on. Similar to using the |
order: ^,^+1,[*] |
Randomize all, but anchor option(s) starting at the beginning. Anchor the first option ('^'), the next option ('^+1'), and so on. Similar to using the |
|
Reverses the order of all options in a list according to their original positions. |
Tip! There are additional tags in IntelliSurvey's Survey Programming Language (SPL) that can be used in place of the order
tag. See Randomizing and anchoring options and alphabetize for more information.
Related tags
In addition to ordering question options, you can also organize all three axes of tables, card sorts, and ranking questions. These tags accept the same input as the order
tag. Also, as mentioned above, there are tags to override existing list orders as well as to apply previously used orders to other lists.
Tag | Description |
Other order tags | |
---|---|
cardorder |
Specifies the order to apply to the cards in a card sort question. |
colorder |
Specifies the order of columns in a table. |
itemorder |
Specifies the order of items (elements to be ranked) in a ranking question's list. The |
roworder |
Specifies the order of rows in a table. |
flatorder tags | |
flatcolorder |
Overrides the existing order of a list with multiple collections for table columns. |
flatorder |
Overrides the existing order of a list with multiple collections for table options. |
flatroworder |
Overrides the existing order of a list with multiple collections for table rows. |
orderfrom tags | |
cardorderfrom |
Uses the order from a previous widget and applies it to the cards in a card sort question. |
colorderfrom |
Uses the order from a previous widget and applies it to the list referenced at a |
optorderfrom |
Uses the order from a previous widget and applies it to the list referenced at an optsfrom tag. |
orderfrom |
Uses the order from a previous widget and applies it to a setlist or question that does not use other listcall tags (e.g., optsfrom ). |
roworderfrom |
Uses the order from a previous widget and applies it to the list referenced at a rowsfrom tag. |
Additional information and examples for defining table order are available in Ordering tables: rows, columns, and options.
Additional examples
Using a comma-separated number string
The order
tag references each option by its position on the widget. The below uses the order
tag to show the options in reverse order. Note that the tag's input is still '3,2,1' even though the option IDs are 11, 21, and 31.
setlist: MY_LIST order: 3,2,1 11. First option 21. Second option 31. Third option
1. This question shows the options in reverse order.
type: radio
optsfrom: MY_LIST
Specifying multiple orders with 'or'
You can specify multiple ordering options within a single order
tag by including the 'or' operator. For example, clients often request to display answer options in their programmed order or reversed order, commonly called "flipping".
In the example below, the answer options will either be shown in their natural order or in reversed order.
5. How much do you like traveling?
type: radio
order: (*) or reverse(*)
1. 1 - Don't like it at all
series: 2..4
5. 5 - Like it a lot
Re-ordering a single list on a question
To override an existing list order, place an order
tag with the new input directly on the widget calling the list. In the following example, the order:[*]
tag applied to Q1 overrides the order specified in the DOGS setlist. If the DOGS list is used again in a later question, it will retain the original '3,2,1' order. However, if a later question references Q1 as a derived list (using Q1.options
), it will use the randomized order defined at Q1 instead.
setlist: DOGS
order: 3,2,1
1. Pug
2. Dalmatian
3. Boxer
1. Which of these is your favorite dog breed?
type: radio
order:[*]
optsfrom: DOGS
1A. Now this question shows the original, reversed order.
type: radio
optsfrom: DOGS
Tip! The order
tag is used on questions that reference a list via an optsfrom
tag. To override the order for lists called via rowsfrom
or colsfrom
tags, use the roworder
and colorder
tags, respectively.
Re-ordering multiple lists on a standalone list
When building a new list from multiple collections, such as combining two lists or adding a new option to an existing list, you can apply the flatorder
tag to overwrite the option ordering. The flatorder
tag "flattens" the hierarchy of the collections, allowing each individual list option to be be directly referenced.
In the example below, the table rows come from two sources. The flatorder
tag randomizes all options together so that the two collections are mixed.
setlist: CHEESE
1. Cheddar
2. Swiss
3. Provolone
setlist: BREAD
4. White
5. Wheat
6. Rye
2. Please select your favorite cheeses and breads.
type: checkbox
flatorder:[*]
optsrom: CHEESE
optsfrom: BREAD
Tip! Similarly, just as flatorder
overrides an ordering scheme previously applied to options, you can use flatcolorder
to override an ordering for columns and flatroworder
for rows.
Using an order from a previous question
If you have multiple questions using different variations of a list, you can keep the same order for all option sets, provided each list has the same number of options. In the example below, the randomized order assigned to the PETS list at Q10 is the same order used for the BABYPETS list at Q11.
set list: PETS
order: [*]
1. Cat
2. Dog
3. Horse
97. Other {autoother: y}
10. How likely are you to own the following pets?
type: radio table
order: [*]
1. Extremely unlikely
2. Somewhat unlikely
3. Neutral
4. Somewhat likely
5. Extremely likely
rowsfrom: PETS
set list: BABYPETS
1. Kitten
2. Puppy
3. Foal
97. Other {autoother: y}
11. If you could have a baby pet, which pet would you most like to have?
type: radio
optsfrom: BABYPETS
orderfrom: PETS
Placing the 'order' tag directly on the listcall
It is also possible to put ordering instructions on the same line as a listcall (e.g., optsfrom
). Simply place the order
tag and its input inside square brackets ('[ ]') after the list name.
setlist: X1ROWS
1. Apple
2. Toyota
3. Coca-Cola
X1. Tell us one word to describe this brand.
type: text table
rowsfrom: X1ROWS [order: [*]]
Note that order
and orderfrom
can be placed inline next to a listcall. However, the related tags roworder
, roworderfrom
, colorder
, and colorderfrom
are not supported in this way.
Comments
0 comments
Please sign in to leave a comment.