The order()
method is used to define sequencing patterns in a custom ordering variable.
ORDERVAR.
invisible: y
type: text
cvalue: order('[1..3],4')
setlist: LOCATIONS
1. Springfield
2. Shelbyville
3. Capital City
block: <<END
1_%%ID%%. For your %%TEXT%% location, what part is ordered most frequently?
type: radio
order: $QORDERVAR
1. Collets
2. Tool inserts
3. Chamfer bits
97. Other {autoother: y; placeholder: Specify part}
END
freeform: y
list: LOCATIONS
In the above example, QORDERVAR is used to apply the same option sequence to each iteration of a question in a block. While the first three options are randomized in Q1_%%ID%%, the fourth option is always shown last.
Details
- The
order()
method is used with thecvalue
tag and must be stored in atype: text
variable. - The specified order must be surrounded in single quotes within the parentheses as shown above.
-
order()
can define both explicit orders (e.g.,order('4,1,2,3')
) or ranges (e.g.,order('5,1..3,4')
). Square brackets can also be used for randomizing elements. - The order string specified with
order()
should not include anchored elements such as '$' or '^' or "wildcards" ('*'). -
order()
can also accept variable references as input.
Additional examples
Displaying options in order or reverse order
The order()
method can use other variables to define a sequence. The Q8ORD variable uses the selection from the coded single select variable Q8ORDER to determine whether to display an element set in reverse order '(5..1)' or its original order ('1..5)'. Q8 then references $Q8ORD and applies the sequence to show the scale in its programmed order or reverse.
While coded single select variables have a built in selectby: condition
, since no conditions are specified in Q8ORDER, the selection is made randomly.
8ORDER. Q8 Likert scale order
type: coded single select
1. Ascending (Not at all likely -> Very likely)
2. Descending (Very likely -> Not at all likely)
8ORD. Q8 Likert scale order
type: text
invisible: y
cvalue: order( $Q8ORDER == 2 ? '(5..1)' : '(1..5)' )
chapter: managers_only
8. Please select "Very likely" from the list below.
preface: This question is testing your likelihood to pay attention while taking this survey.
desc: Attention question
type: radio
order: $Q8ORD
1. Not at all likely
2. Not very likely
3. Neither likely nor unlikely
4. Somewhat likely
5. Very likely {qualify: Q8 | "Very likely" NOT selected}
pagecss: div.i-has-issue.i-has-caution {display: none !important;}
Comments
0 comments
Please sign in to leave a comment.