The orderfrom
tag allows you use the order from a previous list, question, or variable.
setlist: SODA
randomize: y
1. Cola
2. Root beer
3. Lemon-lime
2. Which of these soda types are you familiar with?
type: checkbox
opts from: SODA
3. And which of these brands are you familiar with?
type: checkbox
orderfrom: SODA
1. Coke, Pepsi
2. A&W, Mug
3. Sprite, Starry
In the example above, Q3 will display the options in the same order as those in the list SODA are displayed at Q2.
Details
- The
orderfrom
tag accepts a question label (e.g.,Q1
) or aset list
name as input. It then applies the ordering from the referenced widget. - The list or question label referenced by
orderfrom
must have anorder
orrandomize
tag to parse successfully. - The
orderfrom
tag has variantsroworderfrom
andcolorderfrom
to reorder table rows or columns based on the order of another widget. - The
orderfrom
tag can be used inline with listcalls likeoptsfrom
,rowsfrom
, orcolsfrom
using square brackets.
Caution: Both the widget using orderfrom
and the referenced widget must have the same number of options to avoid missing options.
Additional examples
Using related tags 'roworderfrom' and 'colorderfrom'
When used in a table, the orderfrom
tag will re-order the table's options list only. To re-order the rows or columns of a table, use the variants roworderfrom
and colorderfrom
. These tags will apply the ordering from the widget specified to the table's rows and columns, respectively.
In this example, the rows appear in the same order as the options from the MY_LIST widget.
setlist: MY_LIST
order: (5,3,4,1,2)
optsfrom: series[1..5]
4. How often do you use these brands?
type: radiotable
optsfrom: series[1..5]
headings: Never, Always
roworderfrom: MY_LIST
rows:
1. IBM (1)
2. Kleenex (2)
3. Sony (3)
4. Nabisco (4)
5. Helsinki (5)
Inline as a decorator
The orderfrom
tag may also be used as a decorator on a listcall (optsfrom
/rowsfrom
/colsfrom
). To do this, use square brackets.
5. This is a question with ordered options.
type: radio
randomize: y
optsfrom: series[1..5]
setlist: OPTIONS_FOR_Q6
1. Strip mall (1)
2. Parking spot (2)
3. Peach tree (3)
4. Golf ball (4)
5. Mining (5)
6. This is a question that will use the order from Q5.
type: radio
optsfrom: OPTIONS_FOR_Q6 [orderfrom: Q5]
Comments
0 comments
Please sign in to leave a comment.