Sorting list according to another list

Hi all,

I guess I have a simple problem this time. I would like to sort a list of wall types according to the Area of its wall elements. In the picture below you can see:

  • Under List.UniqueItems: The Wall Types in my project, to be sorted.

  • Under Math.Sum: The total area per Wall Type. the list order corresponds to the list order of the wall types list mentioned above.

  • Under List.Reverse: The total area per Wall Type, sorted from large to small, this is how the wall types have to be sorted as well.

So, how can I sort the Wall Types list (under List.UniqueItems) according to the Area (under List.Reverse)??

Thank you for your insight, again!

Use “groupbykey” node.

1 Like

1 Like

Both of your suggestions sort the wall instances, whereas I am looking to sort the wall types by Area (the Area being the sum of the instance area’s. Please see the attachment in my original post:

The W111 wall type corresponds to the Area (sum of instances) of 112.03612… (list under the node ‘Math.Sum’)
The W629 wall type corresponds to the Area of 16.78 (list under the node ‘Math.Sum’)

Now, It is easy to sort the Area list from large to small. You can see I did that in the list under the node ‘List.Reverse’. What I cannot figure out is how to sort the wall type list (the list under the node ‘List.UniqueItems’) in the same order as the Area list, so that the list items of both lists still correspond.

I think you are right that it should be something like ‘groupbykey’ or maybe using a dictionary but I cannot get it to work…

Thank you for your perseverence! :slight_smile:

Is it something like this you are looking for? (Mind the lacing on List.FirstItem and .Lastitem)

1 Like

You can also use Clockworks List.SortListsofLists in some way or another.

1 Like

Brilliant, both of your suggestions work nicely! Thank you.