Uploading reference or lookup data for Survey123

1423
5
09-09-2021 02:00 PM
dtlhlbs
New Contributor II

Our customer would like to have data from our platform available as dynamic lookup/reference data when filling in Survey123 forms. The data would need to be refreshed often and available offline. I'm aware of pulldata() for calling APIs to get data, but we want this data to be available offline. I read some mention of a "media" folder the scripts or pulldata() may have access to but can't find any references for this.

The required data may be statistical in nature, e.g. 5th/95th percentile so we can validate entries fall within a range, or lookup lists to populate dropdowns or even data to chart as a reference. Ideally, we can upload the required data as JSON and then just reference this in the script.

Is there anywhere in ArcGIS where we can upload and store such data blobs that both Survey123 and FieldMaps apps would have access to? I couldn't find anything relevant in the API, although I am new to ArcGIS and may not know where to look.

5 Replies
jcarlson
MVP Esteemed Contributor

If you need to use it offline, then the media folder is the only way to do it. In Survey123 Connect, you can click Files to open the folder.

jcarlson_0-1631223942504.png

You'll see the media folder in there.

jcarlson_1-1631223961618.png

For Field Maps, there may be an alternative solution, but you're better off asking that question in the Field Maps space here, in order to get the best answer.

- Josh Carlson
Kendall County GIS
0 Kudos
dtlhlbs
New Contributor II

Thanks, is there a way to upload to this media folder via the API or must scripts and files/media be manually managed?

0 Kudos
jcarlson
MVP Esteemed Contributor

That's a good question. I know that surveys can use "linked content" and connect to a hosted CSV file, and that can be updated via the API. But that doesn't do much good in an offline environment.

Looking at a Form item's JSON, you can see that what's uploaded to AGOL / Portal is a survey-name.zip file. You can programmatically download this ZIP file, but "Form" doesn't appear to be an option when adding a ZIP to your Contents. It's unclear if you can (or even whether you should) update the form in place from a ZIP file, but it's a neat idea.

On the Form item's settings page, you can attach a ZIP of code and specify a data source URL, but I have no idea if this is accessible in the form itself.

jcarlson_2-1631226063380.png

 

 

- Josh Carlson
Kendall County GIS
0 Kudos
DeonLengton
Esri Contributor

Hi

What you can do is to use the Linked Content to link your survey to a hosted CSV file as Josh mentions. 

The first step would be to create the CSV file then upload it to AGOL as an item. Then you can link this CSV file to a published survey and use "select_one_from_file filename.csv". Whenever your survey opens up it will do a check to see if the CSV file on AGOL is newer than the one on the device, if it is it will download the file to your device for offline use.

DougBrowning
MVP Esteemed Contributor

Linked content is the way.  See more in this post (note there are 2 ways posted here use the Linked Content one).

https://community.esri.com/t5/arcgis-survey123-questions/automate-publishing-of-survey123-project/m-...

 

0 Kudos