Populate Select_One list from feature service

8271
27
Jump to solution
10-07-2020 05:45 AM
AndrewBowne
Occasional Contributor III

Hello,

Is it possible to populate a select_one list from attributes retrieved from a feature service?  I assume I will need to use a custom javascript function to get the data.  I have been doing a lot of reading and I can't find a definitive answer that says if this is possible or not.  I'd like to pull the values of a two fields.  One field would be the label ("Name") shown on the survey and the other would be the value ("GUID") that would be submitted with the survey.

A second part to this is... If this is possible, can this be executed when the survey opens?   I'd like this list to be the first item a user chooses from when they start the survey.

Thanks!

0 Kudos
3 Solutions

Accepted Solutions
by Anonymous User
Not applicable

Hi Andrew,

You are correct, populating a select one choice list from a feature service URL (or any other type of data service from URL) is not currently supported. This is logged as enhancement ENH-000119959 and something that will likely be supported in a future release.

Using a JavaScript function and the pulldata() at JavaScript expression, this would be possible to achieve what you are wanting to do. However you will need to write your on JS function. If you want this to be the first question in your survey, this should also be possible if you use hidden/calculate questions before the first visible question, so that the values retrieved from the FS are available for the first question to be populated.

Regards,

Phil.

View solution in original post

by Anonymous User
Not applicable

Hi @KyleSchultz1,

The search() feature is currently only beta and therefore only documented in the Early Adopter Community. This feature will be released in the upcoming 3.13 release, and will be available for both the Survey123 feild and web apps. The online documentation will be updated once 3.13 is released.

For now you can test out the search() feature using the 3.13 beta builds available on EAC.

Regards,

Phil.

View solution in original post

0 Kudos
by Anonymous User
Not applicable

Hi @HeatherBell,

Yes this can be done using the search() appearance direct to a feature layer/table, or you could use linked content to a hosted table or CSV. You will need to be using the latest version 3.13 of Connect and field app for this to work. Refer to following blogs and doc:

https://community.esri.com/t5/arcgis-survey123-blog/dynamic-choice-lists-using-search-appearance/ba-...

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformsappearance.htm#ESRI_SECTION1_46A7...

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformessentials.htm#ESRI_SECTION1_34A4D...

Regards,

Phil.

View solution in original post

0 Kudos
27 Replies
by Anonymous User
Not applicable

Hi Andrew,

You are correct, populating a select one choice list from a feature service URL (or any other type of data service from URL) is not currently supported. This is logged as enhancement ENH-000119959 and something that will likely be supported in a future release.

Using a JavaScript function and the pulldata() at JavaScript expression, this would be possible to achieve what you are wanting to do. However you will need to write your on JS function. If you want this to be the first question in your survey, this should also be possible if you use hidden/calculate questions before the first visible question, so that the values retrieved from the FS are available for the first question to be populated.

Regards,

Phil.

AndrewBowne
Occasional Contributor III

Thanks for the information, Phil.  This is very helpful and look forward to this being supported in the future.

If I were to use a custom JS function to return field values as JSON, how would I parse those into a format that would be consumable by a select_one choice list?

Thanks,

Andrew

0 Kudos
GarethFinney1
New Contributor III

Andrew 

This is exactly the question I'd love to see answered. I can pull data for one off (single item) display in Notes, and or Text types, but to have a series of values populate a list and not rely on the list being defined in the choices, or external choices is key here..

any advice truly appreciated

thanks

Gareth

0 Kudos
by Anonymous User
Not applicable

Hi Andrew and Gareth,

Sorry for the confusion, it is not possible to populate or update a choice list (select one or multiple) from a JS function. It is possible to return a value from another source based on a query or calculation, or return a comma separated list or JSON object, however you still need to process it into the survey as a value into a question.

We are currently working on a new feature in beta, for 3.12 beta update, which will allow you to use a select one or multiple and use the search() function to query a feature service and populate the choice list directly. I believe this is what you are after. Keep an eye out for the next Early Adopter Community update and documentation, on how you can test this out in 3.12 beta.

Regards,

Phil.

0 Kudos
by Anonymous User
Not applicable

Hi Andrew and Gareth,

Good news, just letting you know that in the latest 3.12 beta builds available on the Survey123 Early Adopter Community we have made significant improvements to large choice lists which improve the survey load time in both Connect and the field app.

On top of this there are now some new ways you can manage your choice lists dynamically and update them without having to republish the survey, meaning choice lists can now be populated and updated dynamically from a CSV file or hosted table shared in ArcGIS or directly from a feature service using the search() function. Please check out the latest announcement on EAC and test out these new beta features with the latest 3.12 beta builds.

Regards,

Phil.

0 Kudos
AndrewBowne
Occasional Contributor III

Awesome, thanks for the update.   I'll check it out

RosemaryHatch
New Contributor III

Hi Phil,

I was wondering if there is any more documentation on populating choice lists dynamically from a feature service? I seem to keep going in circles reading through the updates, and am hoping you can point me to the most recent development. 

Thanks,

Rosemary

0 Kudos
by Anonymous User
Not applicable

Hi @RosemaryHatch,

The documentation for Linked Content using external choice lists from file or hosted file, and for pulldata() can be found here: https://doc.arcgis.com/en/survey123/desktop/create-surveys/publishsurvey.htm#ESRI_SECTION1_90818E24D...

For the search() functionality, which can be used to query a hosted feature service, that is still a beta feature and is documented in EAC here: https://earlyadopter.esri.com/project/article/item.html?cap=e69ef91f45744b98882c651f7b518eb7&arttype...

Regards,

Phil.

0 Kudos
RosemaryHatch
New Contributor III

Thanks Phil! The search feature is exactly what we are looking for in our workflow. Is there a timeline for when this will be released out of beta? 

0 Kudos