Sort Multiple list or nested list by one list order

Is there a way to sort multiple list by one lists natural order?

Below you can see the nested list to sort, what List.SortNatural does and what my desired intent is. I want to sort each nested list by the natural order of the first list. The actual list I’m working with are separate not nested.

Cody, you fool. It’s obviously List.SortByKey!

1 Like

When I tried to apply the above script to my real script I realized that my example was over simplistic and therefore didn’t work.

My lists were a bit more complicated. The issue is that while this works great with two sets of information, I’m dealing with 70+ such sets in my actual script. Any ideas to get this to work with that amount of data without having to separate them out like I’m doing here.

I would expect one of these to work. Both have issues. The first only seems to go through the first list while the second goes through everything but you loose the nested structure and null values are added.

[Edit 1]

Think this has something to do with having different list structure for my list and key, but I can’t figure how to fix it.

[Edit 2]

Think I got it I shouldn’t have transposed. This way 1 only have to do it three time in the example and 4 times in the actual script.

1 Like