Rank Order questions in scripting
Use scripting to get, set, and unset values for Rank Order questions.
Rank Order items are zero-based. Therefore, a question with 5 items (i1,
i2, i3, i4, i5) has an authored index of
0
,
1
,
2
,
3
, and
4
.
Function or property | Description |
---|---|
datapoint.set([1,3,0]);
|
Sets and ranks Rank Order items (zero-based). The authored indexes must be within range and unique. |
datapoint.set([])
|
Unsets the data point.
Set(undefined/null) will throw an exception.
|
datapoint.get() => [1, 3, 0];
|
Gets the ranked items.
[] is the default value that is returned if no
items are ranked.
|
dataPoint.unset();
|
Removes the ranking from all ranked items and sets the question to not answered. |
Example | ||
---|---|---|
A Rank Order question has 5 items. The zero-based authored indexes range from 0 to 4.
Consider the following function example:
This function will return: Ranked
Unranked
|