Arcade Count Attachments in Related Table

3531
2
Jump to solution
11-14-2021 06:17 PM
MarcoPoetsch
Occasional Contributor II

Hello all,

 

 

I would like to return the number of attachments in a related table.
Is this possible?

I know how to count he number of related records, and I know

var relatedrecords = FeatureSetByRelationshipName($feature, "MonitoringPhotoSites")
var cnt = Count(relatedrecords);
return cnt;

And  I know how to count the attachments in the feature

Count(Attachments($feature)

 

But I'm not quite sure how to combine those two together. Has anyone an idea?

 

Cheers,

Marco

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

Something like this?

var related_records = FeatureSetByRelationshipName($feature, "MonitoringPhotoSites")
var cnt = 0
for(var rr in related_records) {
  cnt += Count(Attachments(rr))
}
return cnt

Have a great day!
Johannes

View solution in original post

2 Replies
JohannesLindner
MVP Frequent Contributor

Something like this?

var related_records = FeatureSetByRelationshipName($feature, "MonitoringPhotoSites")
var cnt = 0
for(var rr in related_records) {
  cnt += Count(Attachments(rr))
}
return cnt

Have a great day!
Johannes
MarcoPoetsch
Occasional Contributor II

Yep, thats it. Not sure what I did wrong. I tried a for loop, but it seems that I missed something...

Anyway, thanks Johannes!

0 Kudos