Updating field types in existing Survey123 Surveys

5786
0
01-31-2017 06:48 PM
JohnathanHasthorpe
Esri Regular Contributor
16 0 5,786

Despite the best planning of your surveys, there may be circumstances when you need to change the data type of one or more of your questions. For example, you may have a question that will only accept integers, when you now need it to accept strings. The simplest way to do this is to make the change in XLSForm spreadsheet and republish the survey. However, the issue here is that Survey123 will need to republish the survey’s hosted feature service AND will delete your existing data in the process. If you want to do such a schema change BUT want to keep all your existing data, then keep on reading.....

Before we continue, there is a caveat: Not all field types can be successfully converted from one to another, and even if a conversion works – you could reduce the precision or integrity of your data. Please make sure that you consider the implications of any data type conversions before proceeding with this workflow.

High level workflow:

If you are comfortable with ArcGIS Online here is what you need to do (If not, I have attached a more detailed step by step document):

In the ArcGIS Online:

  • Back up the hosted feature service for the survey to a FGDB.

In the ArcGIS Online Map Viewer:

  • Add a temporary field to the hosted feature service. This should be of the new field type you are converting your question to.

  • Update the temporary field with the values from the original field.

  • Delete the original field

  • Create a new version of the original field, but give it the new data type that you require.

  • Update this new field with the values from the temporary field.

  • Delete the temporary field.

In Survey123 Connect:

  • In the XLSForm Spreadsheet, update the data type for the target question. This should now match the data type of the new field you created.

  • Republish the survey. You should receive the message that your data will not be affected.

  • Test the survey on the Survey123 field app.

  • Start collecting!