Flatten multi-dimensional list

Hello, I have a multi-dimensional list, which contain multi number of lists in level 2 and 3 and normally single item list in level 1 but occasionally it got 2 items in some of the level 1 list. I want to remove all second items in level 1 lists but keeping the multi-dimensional list structure. I have try “List.First Item”, “List.Take Items”, “List.Normalize Depth”, “List.Remove Item At Index”, “List.Filter by Bool Mask” and "List.Flatten. But they don’t work in the way I want. May I have any suggestion on how my task could be done?

Can’t test it out right now but have you tried List.FirstItem with @@L1 or @@L2? The double @ is when you have Keep List Structure checked. To enable this in the current Dynamo versions, you have to check that option, save the graph, close the graph, and then reopen. It should then be blue with @@L1 or @@L2.

Hello Kenny,
Thank you for your advice!
I’m using Dynamo version 2.0.2 and I can’t find the double @ option. Is it a new option in version 2.1?

The double @ option started in 1.3 I believe (maybe earlier, I can’t remember) and it is in 2.x+. You can access it by clicking the arrow next to the list input (where you would go to enable levels) and it is the second option in the drop down menu, right below enable levels. It should read Keep List Structure.

Oh! Thank you!

Thank you very much!
Both “Take Items” and “First Item” work. But with a little bit different. I need to check which is better for my case.

1 Like