Count identical items in list by dividing into sublists

revit
dynamo

#1

Hello,

I have a node which lists all elements at level, and then an Element.GetCategory connected to it.
I’d like to be able to divide the elements into sublists by category so that I’ll be able to count the number of elements in each category. I haven’t been able to figure out the logic/nodes needed to achieve that.

I also have the Get Categories from Elements node, which lists categories only as unique items. I’m not sure if it will be useful here in getting to a solution.

If anyone can point me in the right direction that would be great.


#2

you can use GroupByKeys Node, the list is the elements, the key from output of Element.GetCategory node


#3

That was the first thing I tried. Unfortunately, the result was far from what I wanted.


#4

convert the result from get category to string … it should work


#5

That worked great, thank you!