List.GroupBy, how to get result form rest of the list?

Hi
I have grouped points by its z value. I’am able to pull the result that I want from index of one sublist, but how can I loop thru rest of the sublist to get the result? any suggestion? Thanks
Works:


Doesn’t work:

I think you just need to put 0..3 in parenthesis. (0..3)
But really you should be able to do it with levels.

Thanks for reply Nick
It still not working. same result, It only return the first list of the sub list.

You just want the first list of every sublist right?
image

1 Like

I hope this image will explain what I want:
group

Then you need to go to the second level. You might also want to keep list structure depending on what you’re doing next.

2 Likes

Thanks a lot Nick, It works. Is there any way to use level syntax in the code block?

You could try setting lacing to longest, but that can be dicey. List.map and a series of functions could also do the trick. Levels is a lot easier and faster though.

When in doubt, right click and use Node to Code to see the Design Script syntax.

1 Like

20170816-2

3 Likes

what a awesome trick:+1:

1 Like