Design sophisticated geospatial surveys with XLSForm: advanced question types, relevance logic, constraints, calculations, groups, repeats, and cascading selects, deployed and managed in KoboToolbox.
KoboToolbox is a powerful platform for mobile data collection, and its flexibility comes from XLSForm, a spreadsheet-based form definition format. This module takes learners beyond basic forms into advanced survey design: geospatial question types, dynamic relevance logic, validation constraints, calculated fields, grouped and repeated sections, and cascading selects.
Learners will also explore form versioning, redeployment strategies, and project permission management, ensuring that surveys remain maintainable and secure throughout their lifecycle.
XLSForm supports specialized question types that capture rich data beyond simple text and numbers. Geospatial question types are particularly valuable for field surveys.
| Question Type | Captures | Typical Use |
|---|---|---|
| geopoint | Single coordinate | Facility location |
| geotrace | Line | Road or river path |
| geoshape | Polygon | Field boundary |
| image | Photo | Site documentation |
| audio | Sound recording | Interview recording |
Relevance conditions control when a question is shown, while constraints validate the values entered. Both use XPath expressions, enabling dynamic and context-aware surveys.
# Example relevance and constraint columns
type | name | label | relevant | constraint | constraint_message
select_one | has_water | Is water available?| | |
integer | water_hrs | Hours per day | ${has_water}='yes' | . >= 0 and . <= 24 | Must be between 0 and 24
constraint_message that tells the respondent what went wrong and how to correct it.
Calculations compute values dynamically from other answers or system data. XPath is the expression language used throughout XLSForm.
# Example calculation
type | name | label | calculation
calculate | total | | ${price} * ${quantity}
calculate | full_name | | concat(${first_name}, ' ', ${last_name})
Groups organize related questions, and repeats allow a set of questions to be answered multiple times within a single submission. These structures are essential for complex surveys.
# Example repeat structure
type | name | label
begin_repeat | members | Household members
text | member_name | Name
integer | member_age | Age
end_repeat | members |
Cascading selects filter the options of one question based on the answer to a previous question. This is useful for hierarchical data such as region โ district โ ward.
# Example cascading select
# survey sheet
type | name | label | choice_filter
select_one rg | region | Region |
select_one ds | district | District | region=${region}
# choices sheet
list_name | name | label | region
rg | north | North |
rg | south | South |
ds | n1 | North 1 | north
ds | s1 | South 1 | south
Forms evolve over time. KoboToolbox supports versioning and redeployment, but redeployment must be handled carefully to preserve data integrity.
| Role | Permissions | Typical Use |
|---|---|---|
| Owner | Full control | Project administrator |
| Editor | View and edit data | Data manager |
| Viewer | View data only | Stakeholder or analyst |
In this lab, you will design a comprehensive field survey that captures GPS coordinates, uses relevance and constraints, includes repeats and a cascading select, and is deployed and versioned in KoboToolbox.
geopoint question to capture the site location.select_one question for region and a cascading select_one for district using choice_filter.begin_repeat section for household members with name and age fields.constraint on age to require values between 0 and 120, with a clear constraint_message.calculate field that counts the number of repeat entries.| Criteria | Weight |
|---|---|
| Correct use of advanced question types | 15% |
| Relevance, constraints, and validation logic | 25% |
| Calculations and XPath expressions | 15% |
| Groups, repeats, and cascading selects | 20% |
| Versioning and permissions documentation | 15% |
| Form validation and deployment report | 10% |
Pass mark for this module: 70%