The rank question type presents a list of choices that the respondent orders by preference or priority. It stores the result as a space-separated list of choice values in ranked order, with the highest-priority choice first.
rtSurvey web form: The drag-to-rank widget is not currently implemented. In the web form,
rankrenders as a select list. Use this type when targeting mobile clients that support the rank widget, or when the stored value format is more important than the drag-to-order interaction.
Basic XLSForm Specification
| type | name | label |
|---|---|---|
| rank priorities | main_priority | Rank these community needs from most to least important |
The choices are defined in the choices worksheet just like select_one:
survey:
| type | name | label |
|---|---|---|
| rank priorities | main_priority | Rank these needs from most to least important |
choices:
| list_name | name | label |
|---|---|---|
| priorities | water | Clean water |
| priorities | health | Healthcare |
| priorities | education | Education |
| priorities | roads | Roads |
| priorities | electricity | Electricity |
Stored value format
The stored value is a space-separated list of choice values in ranked order (first = highest priority):
water education health roads electricityExtracting ranked positions
Use selected-at() to get the choice at a specific rank:
| type | name | label | calculation |
|---|---|---|---|
| rank priorities | main_priority | Rank community needs | |
| calculate | top_priority | selected-at(${main_priority}, 0) | |
| calculate | second_priority | selected-at(${main_priority}, 1) |
selected-at(${main_priority}, 0) returns the value placed first (index 0 = top rank).
Using rank-index() with repeat groups
When rank is used inside a repeat group, rank-index() lets you reference the ordinal rank from outside the repeat:
| type | name | label | calculation |
|---|---|---|---|
| calculate | first_ranked | rank-index(1, ${score}) |
See Functions — Repeated field functions for full details on rank-index() and rank-index-if().
Uses
Rank questions are commonly used for:
- Priority ranking — asking communities to rank development needs
- Preference ordering — ranking product features, service attributes, or policy options
- Exam item ordering — arranging steps in a process
- Top-N selection — combined with
selected-at()to extract only the top 1, 2, or 3 choices
Best Practices
- Keep the list short (3–7 items) — ranking becomes cognitively taxing beyond 7–8 choices.
- Use clear, mutually exclusive choice labels to avoid confusion about what "first" means.
- Add hint text explaining the ranking direction (e.g., "Drag to order: first = most important").
- Validate using
count-selected(.) = xif you need to ensure all choices are ranked.
Limitations
- The drag-to-rank widget is not implemented in the rtSurvey web form.
- You cannot partially rank — all choices must be ordered.
- Keep lists to 3–7 items; longer lists become unwieldy regardless of client.