# Sorting Lists of Lists

**URL:** <https://forum.dynamobim.com/t/sorting-lists-of-lists/841>\
**Category:** Packages\
**Created:** [December 19, 2014, 1:25pm UTC](https://forum.dynamobim.com/t/sorting-lists-of-lists/841 "2014-12-19T13:25:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phillip\_Steffy1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Phillip\_Steffy1](https://forum.dynamobim.com/u/Phillip_Steffy1)\
**Post date:** [December 19, 2014, 1:25pm UTC](https://forum.dynamobim.com/t/sorting-lists-of-lists/841/1 "2014-12-19T13:25:33Z")

</div>

I’ve been using Dynamo for a few weeks now and feel like I learn something new every time I open it up. And usually, no matter what the problem, I can typically find a solution by searching the forum, trying every node combination I can think of, or just sheer luck. However, I’m truly stumped on this one… so any help someone can provide will be greatly appreciated.

I’m trying to sort a list of lists by keys from another list of lists. If I try and do this in Grasshopper, I have no problems (see image). But if I try to do the same thing in Dynamo, things get erratic.

![help01](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/8/89085453ec809ba0ed7d465857519e0f9af1299d.jpg)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

I looked into the amazing Clockwork package from Andreas and he has a node that seems to be perfect for this… “List.SortListOfLists”. However, my lists of lists need to be combined into one list so that it can reference the sorting index. When I try to join them, the lists become consecutive, rather than add another level of lists like it would if the input lists were flattened beforehand.

&nbsp;

![help02](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/5/5fa79a39bec41bd47a7c21d4683c06b5aeb74229.jpg)

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

I hope that made sense. Essentially, I want each input tree to become a separate branch of a new tree. And if thats possible in Dynamo, would that even be what I need to do to get Clockwork’s node to work?

&nbsp;

Again, I appreciate any direction. Thanks!

---

<div class="post-metadata">

**Author:** ![Zach\_Kron](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/zach_kron/32/349_2.png) [@Zach\_Kron](https://forum.dynamobim.com/u/Zach_Kron)\
**Post date:** [December 20, 2014, 8:08am UTC](https://forum.dynamobim.com/t/sorting-lists-of-lists/841/2 "2014-12-20T08:08:49Z")

</div>

Hi Phillip,  
Try the Reorder node. It’s in the mysterious Built In Functions category.  
 ![2014-12-20_0835](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/0/030f65df4348221bd8437ba73503aab9bc6dd018.png)

---

<div class="post-metadata">

**Author:** ![Phillip\_Steffy1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Phillip\_Steffy1](https://forum.dynamobim.com/u/Phillip_Steffy1)\
**Post date:** [December 20, 2014, 11:47am UTC](https://forum.dynamobim.com/t/sorting-lists-of-lists/841/3 "2014-12-20T11:47:47Z")

</div>

Zach,

Thanks! That is exactly what I needed. I appreciate the help and all the work you and your team have put into this. Our firm is excited to see how we can use Dynamo in the near future.
