Prepare for editing existing survey data

In addition to submitting new data to a feature layer through a survey, you may need to edit survey data that you have recently submitted, that has been collected some time ago, or that has been collected by other survey users.

Enable editing

By default, you can edit any previously submitted surveys that exist in the Survey123 field app's Sent box. For more information on how to configure options for sent surveys, see Sent box. To edit existing survey data stored in the survey's feature layer (for example, data collected by another user), you must enable the Inbox.

Note:

To enable editing for your survey, editing must also be enabled for the underlying feature layer.

If your survey's workflow requires editing of submitted surveys, be aware that editing of attached photos is not supported.

To enable the inbox, go to the Options tab of your survey in Survey123 Connect and click Enable Inbox folder. A series of options appears, allowing you to control how users interact with surveys in the inbox. Any changes to these options will take effect when the survey is published.

Survey editing enabled in

Choose whether surveys in the inbox can be viewed (read only), edited, or copied to a new survey. You can type a query expression to limit the surveys that are returned in the inbox. You can also choose to apply a spatial filter.

Caution:

When both the Sent box and Inbox are enabled for a survey, refreshing the Inbox does not download responses currently in the Sent box. This means that if a response currently in the Sent box has been updated by another user, this updated response is not downloaded.

For this reason, it is recommended that you do not enable the Sent box and Inbox for the same survey if your intention is for multiple users to continually edit and update existing responses.

WHERE expressions

The surveys available for editing in the Survey123 field app are determined by the query expression written at the time of the survey's publishing. This WHERE clause must be entered as a text string, so you have full flexibility in terms of the values, operators, and fields that are entered. However, the choices should reflect your editing workflow, have the correct syntax, and have accurate field names. The following are example use cases and syntax:

  • This example searches the EditDate field for dates on or after April 13, 2017:

    EditDate>='2017-4-13'

  • This example searches the Editor field for the name 'BKlauser':

    Editor='BKlauser'

  • This example filters using the status field for all surveys marked with the string 'For Review':

    status='For Review'

  • This example filters the Datefield field for all dates in the last seven days:

    Datefield<=CURRENT_DATE AND Datefield>CURRENT_DATE-7

Inbox queries also support the username variable, to cause the inbox to only be populated by surveys that match the user's ArcGIS named account information. This variable must be specified in the same format as XLSForm expressions, so for example, the query Creator=${username} would search for all records created by the currently signed-in user.

All queries are ultimately run against the survey's feature layer, so building and testing can be achieved by going to its REST endpoint and using the query operation. For more information on this process and examples of query syntax, see the Query (Feature Service) resource.

For more information, see Standardized SQL functions in ArcGIS Online.

Spatial filter

In the inbox, selecting Refresh updates the list of surveys shown on the List tab. The refresh action generally returns all surveys that satisfy the inbox query expression (if set) and that are not already stored in other folders on the device. When selecting Refresh on the Map tab, a spatial filter can be applied to update the list to show only those surveys that are within the current map extent.

To enable the spatial filter, select Apply spatial filter when the map tab is visible on the Options tab in Survey123 Connect. In the following example, when Refresh is selected, the list of surveys is updated to show only the four survey responses visible in the current map extent. If your survey has an instance name set, each feature on the map is labeled with its instance name.

Map tab for spatial filtering

Repeats

Survey123 allows editing of features that have related records either from the Inbox or the Sent box. New records can be added and existing records can be edited, although deleting existing records is not supported. Editing existing records is disabled by default unless allowUpdates=true is enabled through a query parameter.

The bind::esri:parameters column can be used to supply optional parameters for a repeat. These parameters are formatted as key value pairs, with values that contain spaces encased in quotation marks.

By default, no related records are available with the survey responses via the Inbox or the Sent box. To access related records for a response, define a query in the bind::esri:parameters column for the begin repeat question type. The query property supports the same parameters as the WHERE expressions above, for example, query="Editor='BKlauser'", to download only the related records with 'BKlauser' in the Editor field.

To download all records in a related table, specify a query without any parameters (query).

Parameters that can be applied to repeats through the bind::esri:parameters column on a begin repeat question type include the following:

  • query—Allows records to be queried and downloaded to the related table, for example, query="severity='high'".
  • allowAdds—Allows new records to be added to a repeat when editing. The default is true. It can be set to false using allowAdds=false.
  • allowUpdates—Allows existing records in a repeat to be updated when editing. The default is false. It can be set to true using allowUpdates=true.

Multiple key value pairs can be used together separated by spaces, for example, allowUpdates=true query="Editor='BKlauser'". If these values have spaces in them, they can be encased in quotation marks.