Skip To Content

Prepopulate answers

Answers can be prepopulated in Survey123 in a number of ways.

Default answers

Default answers for survey questions can be set in the default column of your spreadsheet when you're designing your survey. This will prepopulate your survey question with the same answer every time you begin a new survey, or when a question becomes relevant. This is especially useful when the answer to your survey question will be the same the majority of the time. You can still edit the default answer if required, but setting the default answer can save you a lot of time and energy when filling out your surveys. Default answers can hold constants such as a strings and numbers.

Note:

Survey123 also supports some expressions in the default column, including today() and now(). To conform to the Open Data Kit (ODK) standard, these expressions should be entered in the calculation column.

Answers to select_multiple questions work differently than others, with each checked answer entered in the order it was selected, separated by commas. To define several values as defaults in a select_multiple field, separate them with commas, for example, item1,item2,item3.

Geopoint questions can support default answers. In the default column of the question, enter the coordinates of the default location as latitude and longitude, both in decimal degrees, separated by a space. Latitude and longitude are the minimum required values for a geopoint; you can also optionally include altitude and accuracy in decimal meters.

Calculations

Calculations are similar to defaults, but there are differences. Unlike the default column, which is evaluated only when the survey is opened or the question becomes relevant, calculations are evaluated every time answers in your survey that are inputs to the calculation change or become relevant. Calculations can take advantage of existing answers in your form. For example, the expression 100 - (number(${Q1})+number(${Q2})) entered in the calculation column of a question will sum the values of questions Q1 and Q2, subtract that value from 100, and set that value as your answer. The user will be able to overwrite that value, but the calculation can provide a starting answer to guide the user.

Note:

The example expression shown above includes the number() function. Default values and answers from other questions are treated as strings when used in calculations. To ensure they are treated as numbers, be sure to use the number() function on these values.

If the result of a calculation is manually edited, a button will appear to erase the edited value and run the calculation again.

Geopoint questions can also support calculations, using the same space-separated values as defaults. To calculate a geopoint from a choice, you can use the substr() or pulldata() function. For more information on both of these, see Geopoints.

Device and user properties

The pulldata() function supports extracting additional properties by using the format pulldata("@property", 'propertyname'). These properties are useful to gather information about the context in which your survey was taken, as well as providing additional technical details.

PropertyDescription

pulldata("@property", 'portalurl')

The URL of the portal the survey is submitted to.

pulldata("@property", 'token')

The token passed to the feature service.

pulldata("@property", 'portalinfo')

All portal information, as a JSON object.

pulldata("@property", 'online')

Boolean value. True if the device has network activity, otherwise false.

pulldata("@property", 'utcoffset')

Offset, in minutes, from UTC for the local timezone.

pulldata("@property", 'language')

Language in use by current survey.

pulldata("@property", 'timezone')

Timezone code.

Favorite answers

After you've entered answers into the Survey123 field app, you can save these answers to use in subsequent surveys by setting your favorite answers. Using the menu in the upper right corner, you can set the current state of your survey to act as your favorite answers.

Once you've set your favorite answers, you can insert them into new surveys by opening the menu and clicking Paste answers from favorite. This will enter your favorite answers into your new survey.

If at any time you need to change your favorite answers, enter them into your current survey and click Set as favorite answers. If you find yourself entering repetitive information in a field, you can use your current answers to prepopulate subsequent surveys. The survey that you use to set your favorite answers will be marked with a star.

CSV data

Populating answers with information that you already have stored on your device can be a great way to minimize the time it takes to complete your survey. The information may be data collected from a previous survey or may provide multiple answers based on the user's entry of a single answer.

An asset inspection survey is an example where prepopulating answers is useful. By entering an asset ID number (by typing it or perhaps scanning a bar code), details of that asset can be retrieved from the CSV file and used to answer other questions such as location, last inspection date, and condition at the time of last inspection.

For additional details on how to populate answers in this way, see Work with external content.