Select to view content in your preferred language

Need some help with pulldata javascript for a pole inspection survey

981
3
07-06-2021 03:06 PM
Nick_Apostolakis
Emerging Contributor

I have a pole inspection survey that originally collected info on the electrical pole and the customer connection on our pole, this was done but using a csv file.  After a few records were done I realized that the the pole info had its fields pre-populated from the CSV file, but the connections (which is a one to many of pole) were not listed so when they would record the info, this caused a problem of duplicating the records if some were already recorded. I then tried to pre-populate the connections same as the pole and found out that you could not pulldata for a one to many from a CSV file.

I was able to accomplish this with a survey from a feature service, but the idea here is to create a feature service for recording the field inspections with their initial values populated from another feature service (which can be updated as poles are asbuilted without overwriting the field inspections),  After inspection values are collected they could then be mass pushed after verified in the office, we do not want the survey to change live data without being checked first.

I found out recently that there is the pulldata javascript functionality, but I have very little to no experience with javascript. what I want to do is ask the user for a geopoint (so we can keep track of poles inspected) then get them to enter the pole number which they would reference off the basemap, with this FacilityID number I would like to use the pulldata javascript functionality to just fill in the fields of the question from a different Feature Service, thus giving them the info for the pole and connections, with the ability to change the values if needed.  

I have seen the example of getting a point from a polygon, but all I really want is to use the FacilityID they supply to pull the data.

We are using a Windows surface tablet so going to Field Maps is not an option and collector is being phased out in a few months.

any help would be appreciated

0 Kudos
3 Replies
JamesTedrick
Esri Esteemed Contributor

Hi @Nick_Apostolakis ,

What you are wanting is an attribute-based query.  This uses the same basic function as the 'Workign with a Feature Service' example in the 'JavaScript' Samples available in Survey123 Connect (the url_requests.js file, featureByLocation function), with the change of including a where variable that selects the pole based on poleid and removal of the geometry, geometryType, inSR and spatialRel variables.

0 Kudos
Nick_Apostolakis
Emerging Contributor

Thank you for replying, I was looking at that example, but my knowledge of javascript is not enough for me to make the changes, I will do some more research and find out how to make the changes. at least I know I am on the right track.

ChristalHigdon_USFS
Regular Contributor

I am looking for the same thing. Adding to the Survey123 Sample to include an example of using pulldata from a csv to get multiple rows from the csv based on a previous question would be most helpful. We have a use case with bridge inspections were there's data in a csv file that is related by an identifier that is a 1:M relationship and we need to pull this data into the survey for field work. Please give us an example ESRI!

0 Kudos