# Get elements from a sorted list

**URL:** <https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [September 20, 2023, 4:28pm UTC](https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919 "2023-09-20T16:28:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajeshjamariya16](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rajeshjamariya16](https://forum.dynamobim.com/u/rajeshjamariya16)\
**Post date:** [September 20, 2023, 4:28pm UTC](https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919/1 "2023-09-20T16:28:40Z")

</div>

Hi, so I’m creating a script to add mark values in rebar elements, I have created two node group to “sort” rebar like you do in the schedule, the first group sorts rebar elements by bar dia, now for 2nd group I was able to sort it by length parameters but I’m not able to get rebar elements (sorted from 1st group) in the same manner as the final “List.GetItemsAtIndex” node. I’ll be using these elements to give them a mark by their diameter i.e. N12XX

 ![Add Rebar mark_2023-09-20_09-58-07](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/3/334e305b26e909c9357fcec332c394917e7fe44f.png)

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [September 20, 2023, 5:19pm UTC](https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919/2 "2023-09-20T17:19:41Z")

</div>

Edit: You’re feeding the indicies list instead of the actual sorted elements list into the Get Parameter Value node. Change as shown below.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/b/7b2b4a21c6f6d46b969649c016eff4ade422f95d.png)

---

<div class="post-metadata">

**Author:** ![rajeshjamariya16](https://avatars.discourse-cdn.com/v4/letter/r/58956e/32.png) [@rajeshjamariya16](https://forum.dynamobim.com/u/rajeshjamariya16)\
**Post date:** [September 20, 2023, 5:23pm UTC](https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919/3 "2023-09-20T17:23:53Z")

</div>

Sorry for the confusion, That’s not what I’m asking about. I should have hidden that “mark group”. To clarify I have sorted rebar elements by length in second group, Now I want to get the corresponding rebar elements to the lengths I’ve sorted.

---

<div class="post-metadata">

**Author:** ![staylor](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/staylor/32/94307_2.png) [@staylor](https://forum.dynamobim.com/u/staylor)\
**Post date:** [September 20, 2023, 5:28pm UTC](https://forum.dynamobim.com/t/get-elements-from-a-sorted-list/93919/4 "2023-09-20T17:28:36Z")

</div>

Oh okay. Try using Sort.ByFunction in place of the List.SortByKey circled below. For that to work, you may also have to remove the connection from the first sorted list to the Get Parameter node also as shown.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/1/91edd36215b26bdaf481d5a7e5f9c8a02159d85f.png)
