Populate fields in Surve123 from a separate table (hosted in AGOL)

388
5
12-03-2021 12:57 AM
DoZ
by
New Contributor III

Hello Everyone,

I need help since I haven't found a related post to my problem.

I am preparing a Survey with Surve123 Connect (version 3.13.249) and a need to autocomplete 3 fields with date store in a table inside my AGOL.

I cannot store the table in the "media" folder since the Table is being constantly and automatically updated.

The example is: Survey will be used from a laboratory to  collect data from water samples. But the field "active_cases" and "Incidence" shall be populated with the latest values which are found in the separate table.

I know there is a way to pull date from a different future service, but not sure how i can do this for a table. I am not that good with scripts.

Is there a way to do so? Thank you so much and kindest regards,

 

Dory

0 Kudos
5 Replies
KristinThorpe1
New Contributor III

Hi Dory! I'm currently creating a survey with two different workflows that may help you. One is to create a dynamic list with the search() function in the appearance column. You must use this with select_one or select_multiple question types.

The second option is to use the pulldata() function. You first write a javascript to pull data from your AGOL table and then you use json to populate fields with specific table records. I think this sounds more like what you are looking for. Let me know if you need more help.

0 Kudos
DoZ
by
New Contributor III

hello Kristin,

thanks for your prompt response, I really need help indeed.

I think the second option is actually what I am looking for, only problem: I have no clue how to write a javascript!! nor how to use a json to populate a specific field within my survey form...

Could you possibly post some links of any posts which deal with something similar so I can try to see if I can copy from them?

 

Thank you very much and kindest regards,

Dory

0 Kudos
KristinThorpe1
New Contributor III

The pulldata() function blog (https://community.esri.com/t5/arcgis-survey123-blog/extending-survey123-smart-forms-with-custom-js/b...) is the only one I used to figure out my workflow. The pulldata(@javascript) function passes fields in your survey to the script. Then use pulldata(@json) to pull fields from your script into fields in your survey. 

I've attached a screenshot of my survey and a file of my script. Copy the text file in a new Survey123 script and change the feature layer and query parameters to return what you're looking for. It was a lot of trial and error. I found it helpful to create queries in the feature service REST api to match the query URL with the query parameters returned with the script.

I hope this helps! 

0 Kudos
DoZ
by
New Contributor III

Cheers!! I will take a look at it during the week end!! thank you sooo much!!

0 Kudos
BarbaraWebster1
Esri Contributor

Hi @DoZ,

You can also link to a hosted CSV in the linked content tab of Connect. The CSV will be stored in the media folder, and each time the survey is opened in the field app the CSV will be updated if there have been any changes to the hosted version. 

See the External choice lists section of the Survey123 documentation for more info.

Thanks,
-Barbara