# Sorting the elements based on parameter which i created

**URL:** <https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [September 19, 2024, 12:41pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488 "2024-09-19T12:41:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmrlircon.bim](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@cmrlircon.bim](https://forum.dynamobim.com/u/cmrlircon.bim)\
**Post date:** [September 19, 2024, 12:41pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/1 "2024-09-19T12:41:47Z")

</div>

Hi,

I have a task that i cant get to work. I want to sort out the elements based on numerical order (ASCENDING) and i already created a parameter (“Location Identity”). In the above image, i want to sort my elements based on the parameter which i already gave. But while using filter by mask i got the elements based on right side highlighted numerical order.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/0/80c54cd4c55d630e025a02f9383957350e90b424.png)

---

<div class="post-metadata">

**Author:** ![Garbage\_Collector](https://avatars.discourse-cdn.com/v4/letter/g/da6949/32.png) [@Garbage\_Collector](https://forum.dynamobim.com/u/Garbage_Collector)\
**Post date:** [September 19, 2024, 12:42pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/2 "2024-09-19T12:42:53Z")

</div>

Hi,

Could you show more nodes and more previews (the daata below the nodes), we cant see what element you are feeding the node

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 19, 2024, 1:09pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/3 "2024-09-19T13:09:10Z")

</div>

Do you want to sort after filtering?

What value are you sorting by? Note that strings won’t sort numerically but by ‘first letter’ so 9/2 will show up after 10/1 as 0 is lower than /. This means you might have to break up your strings and convert to numbers somehow.

---

<div class="post-metadata">

**Author:** ![cmrlircon.bim](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@cmrlircon.bim](https://forum.dynamobim.com/u/cmrlircon.bim)\
**Post date:** [September 19, 2024, 1:50pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/4 "2024-09-19T13:50:57Z")

</div>

[forum.dyn](https://forum.dynamobim.com/uploads/short-url/he31es9ABbmNom0Qvl2RwR6bzkE.dyn) (53.9 KB)  
here i attached the dyn file for your reference.

---

<div class="post-metadata">

**Author:** ![cmrlircon.bim](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@cmrlircon.bim](https://forum.dynamobim.com/u/cmrlircon.bim)\
**Post date:** [September 19, 2024, 1:52pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/5 "2024-09-19T13:52:06Z")

</div>

I want to sort the family based on the parameter which i already provided.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [September 19, 2024, 2:12pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/6 "2024-09-19T14:12:17Z")

</div>

In that case, the process would be this:

1. Gather your elements. This could be done by all elements of category, all elements in view, all elements of type… whatever it may be.
2. Get the relevant parameter value from the elements using an Element.GetParameterValueByName node.
3. Use a List.SortByKey node to sort your list of elements by your list of parameter values.

If you want to add a filter, you do so before step 2 using the method you posted above - filter the list of elements, then use the ‘in’ output of the List.FilterByBoolMask node as if it was the gathered list of elements.

---

<div class="post-metadata">

**Author:** ![cmrlircon.bim](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@cmrlircon.bim](https://forum.dynamobim.com/u/cmrlircon.bim)\
**Post date:** [September 19, 2024, 4:57pm UTC](https://forum.dynamobim.com/t/sorting-the-elements-based-on-parameter-which-i-created/104488/7 "2024-09-19T16:57:14Z")

</div>

Thank you so much now its working fine
