# Reorganising list with two other list

**URL:** https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071
**Category:** Revit
**Tags:** dynamo
**Created:** [June 23, 2023, 8:50am UTC](https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071 "2023-06-23T08:50:35Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![m.quijada](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.quijada/32/56012_2.png) [@m.quijada](https://forum.dynamobim.com/u/m.quijada)
#### Post date: [June 23, 2023, 8:50am UTC](https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071/1 "2023-06-23T08:50:35Z")

</div>

Hello everyone,

I have a problem reorganising a list:  
I have a first list that retrieves the ID of the items in a family in my project.  
I have a second list that retrieves a parameter from this family (its number).  
My third list sorts my second list by increasing number.

Now I’d like to create a fourth list that reorganises my first list in relation to my third list.

Does anyone have any ideas? Thanks ! 🙂

 ![2023-06-23 10_24_05-Dynamo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/0/008d8c14319fe2e702e189dccdb468ed638b76d1.png)

---

<div class="post-metadata">

### Author: ![m.quijada](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.quijada/32/56012_2.png) [@m.quijada](https://forum.dynamobim.com/u/m.quijada)
#### Post date: [June 23, 2023, 9:09am UTC](https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071/2 "2023-06-23T09:09:15Z")

</div>

sorry, I have found a solution with python:

liste\_elements = UnwrapElement(IN[0])  
liste\_numeros = IN[1]

elements\_tries = sorted(liste\_elements, key=lambda x: liste\_numeros[liste\_elements.index(x)])

OUT = elements\_tries

---

<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: [June 23, 2023, 9:54am UTC](https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071/3 "2023-06-23T09:54:18Z")

</div>

List.SortByKey node would do the trick. The list is your first list, and the keys are your second. No need for the third as the sorted keys will be produced along with the sorted list.

---

<div class="post-metadata">

### Author: ![m.quijada](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.quijada/32/56012_2.png) [@m.quijada](https://forum.dynamobim.com/u/m.quijada)
#### Post date: [June 23, 2023, 10:19am UTC](https://forum.dynamobim.com/t/reorganising-list-with-two-other-list/91071/4 "2023-06-23T10:19:38Z")

</div>

it works too!  
Thanks
