Using Calculated Expression on Attachments

478
3
11-13-2023 09:05 AM
LauraGiboo
New Contributor III

I have attachments enabled on a feature service. I am curious how I could set up a calculated expression so that if attachments exist on my point it auto-populates my PHOTO_TAKEN field to "Yes". If no attachments exist, the PHOTO_TAKEN field is auto-populated to "No".

0 Kudos
3 Replies
BlairMcclenathan
New Contributor III

This will differ if you are using a hosted feature, and will probably be easier, but to accomplish this in an enterprise deployment we used an attribute rule on both the related attachment table and also on the feature. This means that the "No Photo" will only show up after the edit has been committed, so after submitting if using FieldMaps. See the attachments for the actual code.

0 Kudos
LauraGiboo
New Contributor III

I am using a hosted feature. I published to ArcGIS Online.

0 Kudos
BlairMcclenathan
New Contributor III

I haven't tried this since we don't often use hosted feature classes, but my first angle of attack would be using the attachments() function and use a count.

https://developers.arcgis.com/arcade/function-reference/featureset_functions/#attachments 

 

0 Kudos