ODK XLSForm Template
ODK XLSForm Template
- The XLSForm standard lets you create powerful forms for the ODK ecosystem.
- A form is defined using 4 sheets:
- The survey sheet defines the questions and logic for your form. It is required.
- The choices sheet defines choices to use in select questions.
- The settings sheet defines form metadata and configuration.
- The entities sheet is used to create entities from form values for use in longitudinal workflows, case ma
- The template sheets contain the most common columns. See the Translations and Additional columns she
- Hover over column names to see a note about how they can be used.
- Columns colored in green on the survey and choices sheets can be translated.
💡 Use File > Make a copy to make a copy of this template that you can edit
💡 Using a consistent column order makes it easier to copy and paste between different form definitions.
💡 Consider hiding columns you don't need instead of deleting them.
Resources
📖 ODK form design docs
🧵 XLSForm tutorial
💬 Forum for support
💡 Have ideas for improving this template? Share them here!
Credits
Styling ideas from yxf script
Inspiration from CartONG's XLSform cheat sheet
Changelog
12/5/2024 Add counter appearance
7/8/2024 Add masked appearance
7/1/2024 Add table-list, hidden-answer and printer appearances
2/13/2024 no-calendar appearance does not work for Enketo
1/29/2024 Add entity_id and update_if to "Additional columns", add table-list to appearances, add grid theme
11/2/2023 Add decimal and text numbers for thousands-sep appearance; add filters on types, appearances a
### Add Make a copy tip to readme
### v2023.1 release
Last update License
12/5/2024 CC BY-SA
The survey sheet's 'type' column determines how the user will be prompted or what will be computed by the
💡 See the Appearances sheet to learn how to modify how a question is displayed to users
💡 The parameters column is sometimes used to configure aspects of a question type that are not appearance
start Record the time when the blank filled form is created
Record the time the last time that the filled form is
end
finalized
today Record the date when the blank filled form is created
Record the install's unique ID (reset on uninstall or
deviceid
cache clear)
username Record the username
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
capture-accuracy, warning-
Yes Yes accuracy, allow-mock-
accuracy
Yes Yes
Yes Yes
Yes Yes
Yes No
quality (normal, low, voice-
Yes Yes only, external; defaults to
normal)
Yes No quality (normal, low, voice-only)
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes Yes
Yes No
Yes No
location-priority, location-min-
interval, location-max-age,
Yes No
track-changes, track-changes-
reasons, identify-user
Appearances
Appearances configure how a question will be displayed to the user on their device
💡 Most appearances for the same question type can be combined by using a space-separated list
Appearance na Description
numbers Restrict input to numeric symbols but save the value as text
multiline Show a text area that is multiple lines tall
url Show a button to launch the website represented by this field
Add the Android app ID of a custom application after the ex:
ex:
prefix to launch that application
Automatically add locale-dependent thousands separators
thousands-sep
on screen but not in submissions
bearing Prompt the user to capture the device-reported compass direc
vertical Show a vertical range slider instead of the default horizontal s
no-ticks Hide tick marks for a range slider (can combine with vertical)
picker Show values in a range as a list of options that can be picked
rating Show values in a range as star ratings
new Only show the option to capture new media, not to select exis
new-front Only show the option to capture a new picture from front (sel
draw Prompt the user to draw an image
annotate Prompt the user to annotate (draw on) an image
signature Prompt the user to sign their signature
no-calendar Show date picker as spinners rather than a calendar
month-year Show date picker for month and year only
year Show date picker for year only
ethiopian Show date picker using the Ethiopian calendar
coptic Show date picker using the Coptic calendar
islamic Show date picker using the Islamic calendar
bikram-sambat Show date picker using the Bikram Sambat (Nepali) calendar
myanmar Show date picker using the Myanmar calendar
persian Show date picker using the Persian calendar
placement-map Show a map that the user can manually place and adjust a loc
Show a map that the user can capture device location on
maps
(but not manually adjust)
hide-input Show a larger map and hide geo input fields by default
minimal Show a text prompt that when tapped shows all choices
search Allow the user to search the list of available choices
quick Advance to the next screen immediately after a choice is sele
columns-pack Show available choices with as may as possible on one line
Show available choices in 2, 3, 4 or 5 columns depending on
columns
screen size
columns-n Show available choices in the specified number (n) of column
no-buttons Show available choices without radio buttons / check boxes
Show available choices mapped to the svg file specified in
image-map
the image column
likert Show available choices horizontally as a likert scale
Show available choices on a map using each choice's
map
geometry column
field-list Show all questions in the field list on the same screen
label Show only option labels to define the top row of a select grid
list-nolabel Show only radio buttons or checkboxes to define the inside of
list Show horizontal radio buttons or checkboxes with their labels
table-list Shortcut for building a grid of list and list-nolabel questions wit
hidden-answer Hides the scanned barcode value
printer Send the value of the question to the printer app for preview
masked Show asterisks (*) instead of what the user is entering
counter Show buttons for incrementing and decrementing
on their device
using a space-separated list
Relevance determines whether a question will be displayed to a user or not. It lets you define branching or sk
💡 Apply relevance to groups or repeats to skip or show multiple questions at once
💡 You can use relevance on a note to provide additional guidance or to confirm a value that could possibly be
💡 You can meet almost any requirement with available functions
false()
on will be displayed to a user or not. It lets you define branching or skip logic in your forms.
o skip or show multiple questions at once
ovide additional guidance or to confirm a value that could possibly be out of range
with available functions
Description
This question will appear if q1 was not blank
This question will only appear if previously-entered age was less than 18
If ${random_value} is a calculate with calculation once(random()), this question will be
shown half the times that this form is launched
Conditions can be combined using and, or
This question will only appear if 'nurse' was selected in q1
This question will appear if -88 was selected in any of q1, q2 and q3
This question will appear if q1's value was less than 12.5 or if 'y' was selected in q2
This question will appear if 'b' was not selected in q2
This question will appear if the answer to q1 had more than 3 characters
This question will never appear. This can be useful when creating a form that is
intended to be customized for different environments. Questions or sections that are
optional can be marked as non-relevant in the template.
Constraints
regex(.,'^[A-Z]{3}+_+[A-Z]{3}+_+[0-9]{4}+_+[0-9]{3,4}$')
regex(., '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[a-zA-Z]{2,4}$')
regex(.,'^\(?[0-9]{3}\)?-?[0-9]{3}-?[0-9]{4}$')
Description
Answer must be a number less or equal to 10
Answer must be a number between 10.51 and 18.39, excluding those values
Answer must be longer than 5 characters
Answer must be a date today or later
Answer must be a date August 1st 2015 or later
Answer to this multi select question can only include 0, 1, 2 or 3 choices but no more
Answer to this multi select question may not include both 'none' and other selections
Another way of expressing the same concept as above: if the 'none' choice is selected, the total
number of choices selected must be 1. Otherwise, any number of selections is allowed. Replace
true() with another expression to specify a requirement when 'none' is not selected
Answer to this multi select question can either be 'none' or exactly two choices not including 'none'
Answer to this text question may have up to 6 letters
Answer must respect a specific structure (for example this one allows the following :
CAR_PRC_2015_048)
Answer to this text question must have an email address structure (note: this is not exact but filters out obviously-wrong inputs)
Answer to this text question must have a North American phone number structure
The answer 9999 is always accepted to represent 'unknown'. Otherwise, this question's answer
depends on ${q1}'s answer: if ${q1} was 'yes', then this answer must be a negative number. If ${q1}
was 'no', this answer must be a positive number.
Translations
label
hint
guidance_hint
constraint_message
required_message
image
audio
video
label::Español (es)
hint::Español (es)
survey
type name label::English (enlabel::Español (
choices
list_name name label::English (enlabel::Español (
as part of the application that shows your form, not as part of the form definition.
d in the form. Otherwise, a dash (-) will be shown for text that is not translated to the current language.
mns have translations for all languages.
You can look up values from lists specified in the choices sheet, entity lists, attached CSVs, attached geoJSON
💡 Choice filters, used to filter lists of items for use in selects, are the same as filter expressions
💡 These queries use a subset of the XPath language. ${} expressions get translated to XPath to access fields
instance('list_name')/root/item[filter expression]/desired_property
instance('list_name')/root/item[match_property = ${q1}]/desired_property
Example query
instance('crops')/root/item[name = ${crop}]/average_yield
instance('days')/root/item[number = ${day_number}]/blood_pressure_needed
instance('data_collectors')/root/item[name = ${data_collector_id}]/visits_com
instance('houses')/root/item[name = ${hhid}]/geometry
count(instance('participants')/root/item[answered = 'no']/label)
💡 You can use these expressions with repeats, too. For example, if ${repeat} is a repeat in your form, you ca
${repeat}[filter expression]/desired_field to access a field in a repeat instance or
💡 If you are looking values up in an attached CSV, you can also use the pulldata
pulldata(list_name, desired_property, match_property, ${q1})
You can filter the list down to one single item or multiple. Filter expressions can use functions and any other logic.
match the filter
ed_property
Description
In a list of crops, use a previously-entered crop name to look up that crop's
average yield.
In a list of days, use a previously-entered day number to look up whether or
not blood pressure needs to be entered that day.
In a list of data collector, use a previously-entered data collector id to look
up how many visits the data collector completed.
In a list of houses, use a previously-entered household id to look up the
geometry (location) of that house.
Filter a list of participants to only those who have not answered yet. Count
the number of matches.
Filter a list of patients to only those with birth year greater than 1978, then
filter that list to females only, then get the child count for each of them. The
full expression computes the sum of all children of females born after 1978.
Get the first name of the Nth child in a household with id ${hhid} where N
is the position of the current repeat in the list of all repeat instances.
the pulldata function. In Collect, this may have better performance for lists with many tens of thousands of elements.
red_property
e function.
ns of thousands of elements.
Additional columns
The default survey, choices, settings and entities sheets include the most common columns. You may find it useful to add s
survey
sheet
save_to
guidance_hint
required_message
read_only
instance::my_attribute
bind::my_attribute
body::my_attribute
choices
sheet
image
audio
video
geometry
settings
sheet
public_key
submission_url
allow_choice_duplicate
entities
sheet
create_if
entity_id
update_if
lumns
s, settings and entities sheets include the most common columns. You may find it useful to add some of the columns described below.
An expression used to determine whether the question's value can be edited or not Yes
A custom instance attribute which will be included along with its value in submitted d Yes
A custom bind attribute. Generally used when an application has a special custom fe Yes
A custom body attribute. Generally used when an application has a special custom f Yes
Public key for encrypting form instances when your server is not trusted Yes
Specify a URL to make submissions to regardless of how the app is configured Yes
Add with 'yes' value if you want a single list on the choices sheet to have multiple
Yes
choices with the same name
A condition that a filled form must meet for an entity to be created from it Yes
The id of the entity that should be updated by filling this form Yes
A condition that a filled form must meet for an entity to be updated from it (with entity Yes
columns described below.
Yes N/A
Yes Yes
Yes Yes
Static values only
N/A
(yes/no)
Yes N/A
Yes N/A
Yes N/A
Yes Yes
Yes Yes
Yes Yes
No N/A
Yes N/A
No N/A
Yes N/A
Yes N/A
Yes N/A
Yes N/A