Skip to main content
Question

Grouping ObjectIDs by Attachment Count Closest to 1,000


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

Hi,

I have a CSV file containing ObjectID and associated AttachmentNumber values.
I want to group the ObjectIDs so that the total number of attachments in each group is as close to 1,000 as possible.
How can I achieve this?

3 replies

crutledge
Influencer
Forum|alt.badge.img+32
  • Influencer
  • May 26, 2025

Hi ​@marta.podsiad I think you could use the StatisticsCalculator. GroupBy ObjectID and that should give you counts for attachments when selected in the Statistics to Summarize.

Hope that helps!


alexbiz
Supporter
Forum|alt.badge.img+11
  • Supporter
  • May 26, 2025

Assuming the following dataset : 



One way to do that could be the following


AttachementSum conditional value : 


GroupID conditional value : 


This method will create groups based on the attachmentSum. Each time the attachmentSum exceeds 1000, the groupID is incremented and the attachmentSum is reset.

It’s a bit tricky, and workbench will give alerts about non-existing attributes, but it will work : 

You can then use the groupID attribute to create lists of obectIDs, concatenate, etc…

Hope that helps !


takashi
Influencer
  • May 27, 2025

It’s a bit tricky, and workbench will give alerts about non-existing attributes, but it will work :

Tips: In a similar case, I would expose the new attribute names with AttributeExposer beforehand, in order to avoid the alerts.


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