Count number of times a value appears in a sublist

Hello,

Needing to count different types of elements in a room and push that info to a Room parameter.

Managed to get the elements grouped by Room using the “Elements in Room” node from archi-lab but I now need to convert them in the format shown in the image below.

Group By Key is producing an error
Warning: Internal error, please report: Dereferencing a non-pointer.
Internal error, please report: Dereferencing a non-pointer.
*List.GroupByKey operation failed. *
Number of items does not match the number of keys.

Any ideas on how I can get the list marked as “goal”?
Thank you for your help.

Try using that instead of List.Flatten and put the keys at L1 too.

image

1 Like

That got rid of the error in Group by key, thanks.

But how can I count the number of occurrences of for each value within its own sublist?

2 Likes

Fantastic! Clockwork to the rescue!

Many thanks, @myrwen.junterealSJC7.