Select to view content in your preferred language

Pulling attachments from a feature layer into a survey.

165
2
12-03-2024 09:37 AM
DarrenSchouls
Emerging Contributor

I'm working on a site inspection survey for over 3000 sites and an important aspect is including a site photo from a previous inspection. I have a feature layer of all the assessment points on AGO and they have a photo attached to each point.

 

I was hoping to link the feature layer to the survey using the unique Site ID, so when the user enters the site ID the survey pulls the attachment from that point into the survey. Can this be done? Any help would be greatly appreciated.

 

Thanks! Darren

0 Kudos
2 Replies
DarrenSchouls
Emerging Contributor

I've tried using pulldata('@layer', FeatureServiceURL, 'attachments', 'Site_ID', ${SiteID}) but nothing appears in the image field. Both the survey and the feature layer are shared with the same group so there shouldnt be any permission issues. 

0 Kudos
JJ_Reyes
Frequent Contributor

Hi @DarrenSchouls - try this method with the attached example.

1) Create a calculated field with a js function (myData.js) to lookup the previous event for the site (in the example case - the "site" is sample_point_guid which we use to get a list of all inspections with that guid, sorted by a field that would get you the most recent. In the js, use queryAttachments syntax to return an attachment URL.

2) Add a note field with the link to the attachment

0 Kudos