Hello,
I am attempting to use pulldata() with javascript to query a nonspatial hosted feature service item and query out an record (and associated attributes) based on an existing value of another data field on my Survey123 form. I've been looking at the Javascript Examples from the Survey123 Connect "samples" library. The example called "Working with a Feature Service" and the featureByLocation script gets me really close to what I need, but I don't need the location functions...just want to pull a record using another attribute (a simple WHERE clause).
Are there any examples of this exact use case someone could point me toward?
Thanks!
Have a look at the ArcGIS Rest API documentation for query, this also works for table layers. There are a couple of useful examples at the bottom of the page. Have a look at the outFields parameter as well to specify what attributes you need.
See the getRecord JS file at: https://github.com/IsmaelInRedlands/Survey123-Tricks-of-the-Trade
Thank you Ismael, this puts me on the right track. I can get the getRecord JS working if I hard-code certain parts of it, but I'm having trouble with the "where" parameter. In particular, it's failing when I use the following:
pulldata("@javascript","QueryFeatureService.js","getRecord",${adminURL},"ISO_CODE='"+${adminISO}+"'",'NAME')
If I just hard-code it as:
pulldata("@javascript", "QueryFeatureService.js", "getRecord",${adminURL},"ISO_CODE='USCO'",'NAME')
...then it totally works fine. So I think I must have something simple messed up in my syntax for that parameter when I try to send an attribute. Any ideas?
I've been having the same issue. Did you have any luck figuring this out?