Skip to main content
Question

Help with Retrieving Attachment Count per Object ID in Enterprise


marta.podsiad
Supporter
Forum|alt.badge.img+9

Hi,

I’m having trouble retrieving only the number of attachments associated with each Object ID for a layer published to ArcGIS Enterprise.

Currently, the only way I’ve found is by expanding the full list of attachments, but this process becomes very slow when dealing with a large number of attachments.

Is there a more efficient method to get just the count of attachments per Object ID without having to load the full attachment details?

Thanks in advance for any guidance.

5 replies

j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • May 26, 2025

You can achieve this in FME form with a traditional Reader (not a Feature Reader, not sure why Safe haven’t).

Select the format Esri ArcGIS Online (AGOL) Feature Service

Under the parameters of you should find this option… “include attachments”. Hopefully the latest FME form has this option on a featureReader, but last I checked… alas it did not

Then check the Format attributes and check on the agol attachments

This will expose it to the canvas. Not sure if it comes as a list, if so, then use ListExploder and from there you can use something like statisticsCalculator to count using a groupby on the ObjectID

https://support.safe.com/hc/en-us/articles/25407508005645-Writing-ArcGIS-Geodatabase-Attachments


marta.podsiad
Supporter
Forum|alt.badge.img+9

Hi, that is exactly the approach I do not want to use as is very slow. I am thinking of using HTTP caller and JSON fragmenter as is faster


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • May 26, 2025

Previous articles all demonstrate Reader > expose list arcgis attachments > explode and counter

 HTTPcaller can use your existing web connection to AGOL and you can utilise the REST api documentation https://developers.arcgis.com/rest/services-reference/enterprise/query-attachments-feature-service-layer/


marta.podsiad
Supporter
Forum|alt.badge.img+9

what am I doing wrong

 


j.botterill
Influencer
Forum|alt.badge.img+40
  • Influencer
  • May 27, 2025

Were you able to read the other articles, in one of the links you'll find an example

Read up on the generateToken page which is required to then queryAttachments.

  1. Use an HTTPCaller to generate a token, then extract the token with a JSONFlattener or JSONFragmenter.
  2. Merge the token onto the points
  3. Query the feature service REST endpoint (ending with a number), e.g. https://gisweb.fortsask.ca/server/SERVICE_NAME/PARK_AMENITY/0/queryAttachments, where objectIds = objectid (from point)
  4. JSONFragmenter to find the image URL
  5. ImageFetcher @Value(URL)?token=@Value(token) to download the image
example of 3. httpcaller to queryattachments endpoint

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings