Grouping lists

Hi guys, with this node, I group the lists according to the index, I mean, It groups the elements correctly, but it assign the index in the order it takes the values… In this example what I want to do is group the elements with the number 0 in the index 0, ignoring the order they appear. In this case, the index 3 is the one which should have 2 elements.



Any ideas??? Thanks!

List.SortByKey after the List.GroupByKey node, using the groups as the lists, and the unique keys as the key.

Seems logic but its not working. I have tried with every possibility about lacing but something is wrong.

@Juan_Jesus_Del_Pino

1 Like


i believe thats what you want right

2 Likes

THIS was the solution, works like a charms. Now Im gonna take my time to understand this. Thanks :slight_smile:


You can see its working cause there are two items in the 3 index.

Good example of list comprehension! Maybe I havent explained it properly. The solution is salvatoredragotta´s image =)

Not sure if I’m just not seeing something, but both solutions work and return the exact same solution. You just need to set lacing and list levels are set correctly in either circumstance.

Here is an example of both using Dynamo 2.0:

And the same graph formatted for 1.3:

2 Likes

Absolutelly right. It was my mistake in lacing. The outputs are just the same:


Thanks!