List sort by level

Hi to all; i 'm a new beginner with dynamo.
I would like to make a script that puts in relation a linked model with my model. In this example i need to know the difference beetween structural and floor finished for each level, than this value wille be transcript as type parameter in floors. The inputs seems to be good but in output, the list is sorted not in order with levels (id level 0 is id level 1, id level 1 is level 2, level 2 is id level 0) Why???
I have pick from revit the id of floors… How can i sort a list of floors in order by level?
Thanks

You could try the sort.byKey node with the levels heights being the keys.

If they are linked to a level you can filter request parameter values and filter them to select the one with the matching name

Many thanks to all.
Solved with sort group by key with element level for keys. T

Hi, I would really appreciate if you posted a simple example of that (“sort.byKey node with the levels heights being the keys”), I’m trying here but can’t get it to work. Thank you in advance

For anyone stumbling across this looking for a solution and as Group by key and sort by key didn’t work for me:

like this,

Group by function.dyn (20.8 KB)