Skip To Content

Prepare for editing existing survey data

In addition to submitting new data to a feature service 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. This is possible with Survey123 for ArcGIS 2.0 and later.

Enable editing

By default, you can edit any previously submitted surveys that exist in the Survey123 field app's Sent box. To edit existing survey data (for example, data collected on another day or by another user), you must specify your intent before publishing the survey.

Note:

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

To enable editing in a survey, you must first enable the inbox. To do this, go to Settings > Inbox for the survey in Survey123 Connect. Choose Enabled from the drop-down list. A query expression edit box appears with a check box (enabled by default) that enables you to apply a spatial filter.

Survey editing enabled in

The inbox may appear to stop responding when too many features are returned by the query. Because of this, it's recommended that you implement a WHERE clause that will limit this number.

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 before the current date. Note that this must be used on a text field using the format yyyy-mm-dd, and will not work on a date field.

    Datefield<CURRENT_DATE

Inbox queries also support the variables username, email, firstName, and lastName, to cause the inbox to only be populated by surveys that match the user's ArcGIS named account information. These variables 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 service, 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.

These queries also support SQL logical operators, allowing the query to perform more complex searches based on specific criteria. This example will return only results from users whose user names contain the user name of the logged-in user, as well as any text before or after it.

Creator LIKE '%' + ${username} + '%'

The following operators are supported by Survey123.

OperatorDescription

ALL

True if all of the subquery values meet the condition.

AND

True if all the conditions separated by AND are true.

ANY

True if any of the subquery values meet the condition.

BETWEEN

True if the operand is within the range of comparisons.

EXISTS

True if the subquery returns one or more records.

IN

True if the operand is equal to one of a list of expressions.

LIKE

True if the operand matches a pattern.

NOT

Displays a record if the condition or conditions are not true.

OR

True if any of the conditions separated by OR are true.

SOME

True if any of the subquery values meet the condition.

Caution:

To run queries using logical SQL operators, your organization's administrator must disable the Standardized Query security option for your organization to allow nonstandard SQL queries. For more information on the ramifications of disabling this option, see about standardized queries in the ArcGIS Server documentation. For more information on standard and nonstandard queries, see standardized SQL functions in ArcGIS Online.

Spatial filter

The spatial filter enables the filtering of surveys in the inbox. Once enabled as part of the survey publishing process, users can use the inbox map view extent to filter the survey data in the inbox list view.

Map view for spatial filtering

When using Refresh on the extent in this image, the field app's inbox will only refresh the five survey responses visible in the view.

Tip:

For the map view to be available, the survey must include a geopoint question. If the survey lacks a geopoint question, the map view will be hidden and spatial filtering will be unavailable.

Repeats

Editing repeats is supported in Survey123 2.4 and later, allowing editing of features that have related records either from the Inbox or the Sent box. New records can be added and existing records edited, although deleting existing records is currently 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.
  • 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.
  • orderBy—Specifies the order of related records by fields.

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.