Sort a column by another one

Hi everyone,

how can I sort two lists using the first one?
For example,i have:
A 1
K 4
C 2
B 6
and I need:
A 1
B 6
C 2
K 4

Use a List.Sort node.

This is my original list

This is list after I use List.Sort. It’s not right.

1 - please share your dynamo graph
2 - please explain what is not right.

That sort looks good to me apart from you have a number 30 at the top.
Where do you want the number 30 to be?

If you want it to be listed under “H” then the fastest solution would be to call it Heat output 30% efficiency rating.

What I need is that if my parameter “Cost” has “PG_IDENTITY_DATA” like group in my original list, it has “PG_IDENTITY_DATA” once I have sort my list by parameter name.

I think you’re saying you want to keep the list structure?
Have you ticked the list structure box?


I’ve tried this way, but it doesn’t work.

Not sure I understand what you are after, but it sounds like List.SortByKey should work here. The list input is the columns for all the data. The key input is the value you want to sort by. Set both to @L2 and use longest lacing.

I’ve supposed that it would be the solution but there’s something wrong.
From DocumentParameters I’ve 5 differents lists, I create a unique one and I want that the columns are sorted in alphabetical order by names list.

Now is working. The keys input doesn’t need any change in levels.

1 Like

Longest lacing with both @L2 might have resolved it as well, but no need to reinvent the wheel here. Glad you’re sorted out. :slight_smile: