Skip to main content

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?

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!


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 !


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.


Reply