This survey will let the user select a monitoring site from a select_one with a field. Depending on the site selected, I want to use pulldata to pull several attributes to fill questions (e.g. lat/long but in a text box so alternate locations can be entered). The following appearance line works:
autocomplete search("UMR_Mainstem_Fixed_2025?url=https://services3.arcgis.com/wPPMe5A6TnW0nbD4/arcgis/rest/services/UMR_Mainstem_Fixed_2025/FeatureSe...")
However, I've been unable to get the pulldata to update based on the answer to that selection:
pulldata("@layer", "getRecord", "https://services3.arcgis.com/wPPMe5A6TnW0nbD4/arcgis/rest/services/UMR_Mainstem_Fixed_2025/FeatureSe...", ${UMR_Mainstem_Fixed_2025})
...pulls the first record from the hosted feature layer. A read-only calculation and a latitude text entry follow. ${fixed_data} is the 'name' of the main pulldata line above:
pulldata("@json",${fixed_data},"attributes.SITE_ID")
pulldata("@layer", "getValue", "attributes.LAT", "https://services3.arcgis.com/wPPMe5A6TnW0nbD4/arcgis/rest/services/UMR_Mainstem_Fixed_2025/FeatureSe...", ${UMR_Mainstem_Fixed_2025})
Both are populated with the attributes of the first feature layer record when the survey is opened. Choosing the select_one option makes both lines blank.
I'm unsure where to troubleshoot next - how do I use the initially chosen select_one choice to query the correct row in the target table?
Solved! Go to Solution.
Hi @MarkEllis,
Have you had a look at the Query a Feature Layer sample form in Survey123 Connect? I believe this sample does exactly what you are describing, and it's easy to follow too. In the sample form, service urls and dynamic where clauses are saved to separate fields and then brought back into the pulldata() functions so that they return the correct information based on previous selections.
Hope that helps!
Hi @MarkEllis,
Have you had a look at the Query a Feature Layer sample form in Survey123 Connect? I believe this sample does exactly what you are describing, and it's easy to follow too. In the sample form, service urls and dynamic where clauses are saved to separate fields and then brought back into the pulldata() functions so that they return the correct information based on previous selections.
Hope that helps!
Rory,
Thank you for the suggestion, I'd not seen that sample. Adding the dynamic WHERE clause as a separate row and variable fixed the disconnect.
Mark