# List sorting conditional

**URL:** <https://forum.dynamobim.com/t/list-sorting-conditional/4397>\
**Category:** Revit\
**Created:** [June 8, 2016, 10:02am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397 "2016-06-08T10:02:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 8, 2016, 10:02am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/1 "2016-06-08T10:02:41Z")

</div>

Hi,

Can anybody help in getting list sorting, I have a list of elements and I want to list them with their name and I want only a set of them to use into my project, but I am not finding a correct way or I am doing something wrong. Any help would be highly appreciated, thanks in advance.

![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/6/67cb22cd8b4542288936b5566d80fb81daa25c90.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:** [June 8, 2016, 10:29am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/2 "2016-06-08T10:29:50Z")

</div>

Hi @Rock_Ali ,  
this should do what you want :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/a/ae5182c130c0add414f4c257a2ea07a2f8e2df74.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:** [June 8, 2016, 10:30am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/3 "2016-06-08T10:30:49Z")

</div>

Hi,  
there are many ways to achieve what you’re after depending on what suits your needs the best. See if any of the below can guide you further:  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/c/c745a8dfe5d53a1d5d20094554a34cb8c1deab56.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:** [June 8, 2016, 10:49am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/4 "2016-06-08T10:49:17Z")

</div>

That’s much better 😄

---

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 9, 2016, 5:43am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/5 "2016-06-09T05:43:46Z")

</div>

First of all thanks to both of you, and special one to Oslen for simplicity, but now I have one more trouble while grouping. I have a list of families starting with CP-100/19…,G-858…,MH-1/1…, and PIT-1/1. With the string from object node (for grouping) it is giving other result. Please help once again and thanks in advance.

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

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [June 9, 2016, 6:05am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/6 "2016-06-09T06:05:43Z")

</div>

Hi,

You can use “Element.Name” node if your looking to group by name:

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

---

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 9, 2016, 6:08am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/7 "2016-06-09T06:08:47Z")

</div>

Finally I able to succeed in a different way (long way I think), may be there is a better way with less nodes, but at the end I able to separate a list of items in a sorted way. If any better way or idea is there, please share, thanks once again.

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

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [June 9, 2016, 6:13am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/8 "2016-06-09T06:13:47Z")

</div>

Did you try with “[Element.Name](http://Element.Name)” node?

---

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 9, 2016, 6:22am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/9 "2016-06-09T06:22:11Z")

</div>

Hi Kulkul, thanks for your reply, with your solution I am not getting the desired result. In your case, thats working fine, but not in my case (may be becoz there is no space in my family names, i think thats the reason it is not grouping properly, or may be I am wrong), if any better ideas please share.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/9/9c3cf92b380b5adf848acfd54704f9e3033a2d59.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:** [June 9, 2016, 9:09am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/10 "2016-06-09T09:09:23Z")

</div>

@Rock_Ali  
This should work in your case. What it does is it groups elements that have names which have the same 2 first characters. You can set the amount of characters you’re interested in :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/2/29f86703592e24d4fd5ccbd45971fb0a2b4057ec.PNG)

---

<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:** [June 9, 2016, 10:17am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/11 "2016-06-09T10:17:35Z")

</div>

Alternative to @Mostafa_El_Ayoubi 's solution:

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

---

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 12, 2016, 5:13am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/12 "2016-06-12T05:13:40Z")

</div>

Many thanks to both of you (Mostafa and Jostein) for your great support, both ideas are working fine with my case and finally, I able to achieve what I was looking for, thanks once again and have a good day, cheers!!!

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/2X/0/02a4b086ce7e6703c333516a45f3cad56daf6624.png)

---

<div class="post-metadata">

**Author:** ![Rock\_Ali](https://avatars.discourse-cdn.com/v4/letter/r/e36b37/32.png) [@Rock\_Ali](https://forum.dynamobim.com/u/Rock_Ali)\
**Post date:** [June 15, 2016, 10:07am UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/13 "2016-06-15T10:07:20Z")

</div>

Hi Guys,

I need some information regarding the way I created the script. Let me brief you something about my current task. I have a family, which has 765 types (family types) and I want to insert data from excel into the family. There are 12 parameters (type parameter), which have to get updated through this script, but the script is taking so long time more than 15 to 20 hours, which is a bit hard for us to work with in the tight schedule. Now, what I want if anybody can correct me with my script if anything is wrong or suggest me any better idea to reduce the time. One more thing, I ran this script on system, which has 32 gb RAM, i7, and 4 gb dedicated graphic card. Please see the below images, I have pastes in three parts but I hope you can understand, the first two are parts, and third one is complete script. There are no errors with the script, but its taking tooooooooooo long time Please provide suggesstion and thanks in advance.

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

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

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

---

<div class="post-metadata">

**Author:** ![atharva.purohit466SX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/atharva.purohit466sx/32/116951_2.png) [@atharva.purohit466SX](https://forum.dynamobim.com/u/atharva.purohit466SX)\
**Post date:** [May 19, 2021, 8:38pm UTC](https://forum.dynamobim.com/t/list-sorting-conditional/4397/14 "2021-05-19T20:38:07Z")

</div>

Hi Ali,

I’m quite late here, just wanted to drop a suggestion for people who’ll be referring to this thread in future, that with advancement of Revit version, the tasks like above are quite quick execute by your existing machine. Revit 2020’s dynamo works really fast!  
Also as you knew that you need to only enter “Type” parameter, you could have used “Set Type Parameter” node by Archi-Lab, to avoid extra process.  
Hope this helps
