Reorganising list with two other list

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 ! :slight_smile:

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

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.

1 Like

it works too!

1 Like