Sort Views by Name Contains

I have a list of views which contain the Mark of the wall they were taken from. So if the View is looking at Wall marked CW1, the View will contain _CW1 at the end of the name. I’m trying to edit a Graph that will sort the views by wall and then place them on a sheet. I’m having trouble sorting the Views by the CW1, CW2 at the end of the name. They need to be sorted because I want them to be placed onto the corresponding sheet. (i.e. Views named CW1 go on Sheet named CW1)

Any suggestions are appreciated, thanks.

Views and Sheets of Curtain Walls 1.0.dyn (34.7 KB)

You can’t sort the numbers without sorting the elements or everything gets out of order. Use SortByKey instead of List.Sort.

2 Likes

Thanks for the reply Nick. How would I go about sorting the elements (in this case views) by the end of the view names (not the whole name)? In this case dropping the Plan Section and only sorting by CW1 or CW2.

Instead of sorting just the character (1 or 2) you want to sort the elements by character. So you you character list would be the key list and the element name would be the list to sort. It’s the same process as List.GroupByKey, you’re just sorting the elements instead of grouping them.

Nick, thanks. Is that not what I’m showing in the first image? Should be working, yes?

@jay.polding It looks to me like the problem with your first image is the List.Sort before your keys input - you’re sorting the keys first, so they are incorrectly associated with their respective views/names

1 Like

Actually you can just get rid of List.Sort all together since you sort them after the grouping. I was going to suggest doing that instead but didn’t see that you had already done it. :grin:

2 Likes

Thanks, that worked.

1 Like