Nested list in nested list count

Some background of the task: I have around 30 family types and they are (as of now) ranging between two different materials. I’d like to count the amount of times each family occurs as each material.


Family x is Mat A 10 times

Family x is Mat B 20 times

Family y is Mat A 15 times

Family y is Mat B 12 times


So I’ve been able to count each family (with the count sublist component) but its as if I would like to count the amount of unique items in each sub list. So one way I see it is to create a list within the sublist and count that, if that is possible (see picture). I have tried group by key and and group by list, but I haven’t been able to get the results I need.

Also i’d like it to be dynamic so if I add a new material to the family a new sublist is generated(or 3rd or 4th etc.). I hope this makes sense, maybe I am approaching it wrong and there is an easier way to count unique parameters per family(this being material).



Under the package “Clockwork,” there is a node called List.CountOccurences which shows all unique elements and the number of time each occurs. That should work (might need to do some list.mapping).

So that gives me the total of each element, not total of each list. I see what your saying about needing mapping then, but i’m not quite sure how to go about that.



Here is a little code that might work for you



Yes that looks great, I can’t test it right now but from what I can see its perfect. nice and clean too! thanks so much i’ll report back when i can test it.