Pull Data from GIS Layer

440
2
07-13-2022 10:29 AM
JoshOsowiecki
New Contributor II

I am running into an error when I try to update my form with a previously suggested calculation. I am using the below calculation

pulldata("@layer","getRecord","https://bethlehem-pa.maps.arcgis.com/apps/mapviewer/index.html?webmap=8f22464a082b44b88939adf8b2ed6c..., USA Census Tract)

Below is  a link to my original post

https://community.esri.com/t5/arcgis-survey123-questions/is-it-possible-to-generate-which-census-tra...

Any help would be greatly appreciated!

2 Replies
JenniferAcunto
Esri Regular Contributor

It is hard to help without seeing your survey XLS form, but I suspect the issue is with the 'USA Census Tract' at the end of your pulldata calculation. I'm assuming that is the name of the field you want to pull in from that feature service but that is not how "@layer" works. Think of it as a 2 step process:

1. You grab all of the associated JSON for a specific record. (You will want to null this field as there's no need to store all of it).

2. You then parse out the field(s) you need. 

Both of these steps are their own line in your survey XLS. If you go back and look at the example Ismael gave you in the linked post, step 1 is the tract_json question: pulldata("@layer","getRecordAt","https://services.arcgis.com/P3ePLMYs2RVChkJx/arcgis/rest/services/USA_Census_Tracts/FeatureServer/0",${location}). Step 2 is the census_tract_id question: pulldata("@json",${tract_json},"attributes.TRACT_FIPS")

Going back to your pulldata calculation, you are also missing the part where you tell the survey which record to pull. This can be done by using location and calling back to a previous question that asked for a location. This is Ismael is doing in the example with ${location} or by using a where clause such as "COUNTRY='Canada'". 

I would recommend using what Ismael provided and simply switching the service url to yours and then changing "attributes.TRACT_FIPS" to whatever the field name is in your service. So if your field name is census_tract then you would use attributes.census_tract.

- Jen
JoshOsowiecki
New Contributor II

@JenniferAcunto Thank you! I was able to get the field to populate!

0 Kudos