Sort Views by Name Contains


#1

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)


#2

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


#3

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.


#4

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.


#5

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


#6

@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


#7

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:


#8

Thanks, that worked.