# Sort List by part of Sublist Value

**URL:** <https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588>\
**Category:** Packages\
**Created:** [March 31, 2016, 3:19am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588 "2016-03-31T03:19:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 3:19am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/1 "2016-03-31T03:19:41Z")

</div>

Hey all,

&nbsp;

I’m trying to sort a list by part of the sublist value, is there anyway to pull out certain data from certain position and make them a list to sort the mainlist?

Any suggestion would be appreciated!

Thanks a lot.

&nbsp;

![Sublist](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/b/be84f2801a5ca071edda7c371ae6a54ff42f60c4.png)

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [March 31, 2016, 3:59am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/2 "2016-03-31T03:59:29Z")

</div>

Hi,

how about this? (make sure the firtitem and lastitem node’s lacing is set to longest)

 ![sort](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/4/4e08212437339c5d2960cfb63ebd353988d50b2b.jpg)

---

<div class="post-metadata">

**Author:** ![jostein\_olsen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jostein_olsen/32/8570_2.png) [@jostein\_olsen](https://forum.dynamobim.com/u/jostein_olsen)\
**Post date:** [March 31, 2016, 4:45am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/3 "2016-03-31T04:45:12Z")

</div>

Hi, if you transpose your list, Clockwork has a great node called List.SortListOfLists which works great.

 ![pic3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/b/bcbf49a2bd07db0f84e6596164a57af8ba2110bc.png)

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 4:46am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/4 "2016-03-31T04:46:28Z")

</div>

Hi, mostafa, this is amazing! There are some empty value in my case(I think I could use boolmask to avoid it), but still it works perfectly, I really learned a lot from it!! Thanks a lot 😉 , wish you a good day!

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 4:56am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/5 "2016-03-31T04:56:12Z")

</div>

Hi, Jostein,

the list.SortListOflists node was also my first try, but I didnt realize that I should transpose the list again, you opened my eyes ! 🙂

Thank you guys for all the helpful answers!

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 5:03am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/6 "2016-03-31T05:03:58Z")

</div>

Hi, Jostein,

I tried it again, unfortunately the list is not really sorted by the marked value with your solution, but still thanks a lot to teach me how to use the list.SortListOflists node!

 ![List](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/1X/b5c1facd84bab83dabd57553c93cd9d4d1d55d44.jpg)

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [March 31, 2016, 6:36am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/7 "2016-03-31T06:36:14Z")

</div>

![20160331-3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/1/1c53de1b18a60e35ecd13dd4ed04e8c1616be2e3.png)

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 6:46am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/8 "2016-03-31T06:46:24Z")

</div>

Hi, everyone, maybe you also have a idea, that we could add another filter or condition (such as level or function) to sort the list again. without breaking the existing order?

I made a bad example here, I use mostafas’ node to sort the list first by the “01,02,03”, then Im not sure if theres a way to use other index as " A,B,C" to sort the list again, so that we get {"00.01,“A”,“x”},{“00.02”.“A”.“y”}, …

Thanks!

&nbsp;

 ![list 3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/6/68c64b7b9fb1a6a0a19c9f1e4d74c2b973453bb2.jpg)

&nbsp;

 ![list 4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/7/7f323bbd010d5574b09bc53219809ac838d2e2e5.jpg)

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [March 31, 2016, 6:56am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/9 "2016-03-31T06:56:00Z")

</div>

Hey, Vikram,

Thanks for your solution, I also thought about editing the string, but didnt know how, thats really effektive!

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [April 1, 2016, 6:42am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/10 "2016-04-01T06:42:43Z")

</div>

Hi Fan Zhou,

here’s a proposition. I’m not sure it’s the best way but it works

 ![sortsort](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/b/bbc3cf3fe7c0b4c3a55d0a035bbedf1401004f60.png)

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [April 6, 2016, 4:23am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/11 "2016-04-06T04:23:35Z")

</div>

Hi, MOSTAFA EL AYOUBI,

I think I didnt describe my question correctly, but still thanks a lot for your proposition.

I was trying to export a roomlist and reorder them first by level (index 1) and then by room number (index 0), your first proposition has already helped me to odered them by room number. Now I m trying to use filter or booleamask to separate the items into several sublists level 1,level 2,… and then combine them again.

I think your last proposition could also do the job with small modification, I would also try myself 🙂

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [April 7, 2016, 1:20pm UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/12 "2016-04-07T13:20:23Z")

</div>

Here is an example of sorting (and grouping) first by index 0 of sublists and then by index 1 of sublists

File: [SortTwice.dyn](http://dynamobim.org/wp-content/uploads/forum-assets/testingwaters/04/07/SortTwice.dyn)

![20160407-6](http://dynamobim.org/wp-content/uploads/forum-assets/testingwaters/04/07/20160407-6.png)

---

<div class="post-metadata">

**Author:** ![Fan\_Zhou](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@Fan\_Zhou](https://forum.dynamobim.com/u/Fan_Zhou)\
**Post date:** [April 8, 2016, 7:15am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/13 "2016-04-08T07:15:27Z")

</div>

Hi, VIKRAM SUBBAIAH,

I didnt know there’s a group node, and your proposition works great!

Thank you very much 🙂

 ![List final](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/d/ddd969c8332a3e5fab89d9aed7b3c08f3da3c905.jpg)

---

<div class="post-metadata">

**Author:** ![vanman](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vanman/32/20881_2.png) [@vanman](https://forum.dynamobim.com/u/vanman)\
**Post date:** [October 2, 2019, 1:04am UTC](https://forum.dynamobim.com/t/sort-list-by-part-of-sublist-value/3588/14 "2019-10-02T01:04:15Z")

</div>

This link and picture seems to be broken 😕
