The rank question type presents a list of choices that the respondent must drag into order (or otherwise rank from first to last). It stores the result as a space-separated list of choice values in the order selected, with the highest-priority choice first.

Basic XLSForm Specification

typenamelabel
rank prioritiesmain_priorityRank these community needs from most to least important

The choices are defined in the choices worksheet just like select_one:

survey:

typenamelabel
rank prioritiesmain_priorityRank these needs from most to least important

choices:

list_namenamelabel
prioritieswaterClean water
prioritieshealthHealthcare
prioritieseducationEducation
prioritiesroadsRoads
prioritieselectricityElectricity

Stored value format

The stored value is a space-separated list of choice values in ranked order (first = highest priority):

  water education health roads electricity
  

Extracting ranked positions

Use selected-at() to get the choice at a specific rank:

typenamelabelcalculation
rank prioritiesmain_priorityRank community needs
calculatetop_priorityselected-at(${main_priority}, 0)
calculatesecond_priorityselected-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:

typenamelabelcalculation
calculatefirst_rankedrank-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:

  1. Priority ranking — asking communities to rank development needs
  2. Preference ordering — ranking product features, service attributes, or policy options
  3. Exam item ordering — arranging steps in a process
  4. Top-N selection — combined with selected-at() to extract only the top 1, 2, or 3 choices

Best Practices

  1. Keep the list short (3–7 items) — ranking becomes cognitively taxing beyond 7–8 choices.
  2. Use clear, mutually exclusive choice labels to avoid confusion about what “first” means.
  3. Add hint text explaining the ranking direction (e.g., “Drag to order: first = most important”).
  4. Validate using count-selected(.) = x if you need to ensure all choices are ranked.

Limitations

  • The drag-to-rank widget requires a touch screen or mouse — it may not work well in keyboard-only environments.
  • On some older mobile clients, the rank widget may fall back to a numbered input interface.
  • You cannot partially rank (i.e., rank only some choices) — all choices must be ordered.
Was this page helpful?