Element list order by parameter

Thank in advance for any advice or suggestions. I’m trying to have my script automatically place legends on a sheet based on the alphabetical legend name. I can get it to place the legends, however, the order is what I’m struggling with. I’ve tried List.SortByKey but it doesn’t look like it’s actually changing the order of the legend viewports.


Legend Placement8.dyn (34.3 KB)

You’re sorting the View Name before using SortByKey, meaning the names are already sorted and no longer match the viewports. Just plug the name directly into SortByKey.

Nick thanks for the assistance! Works perfectly. I did have to add another sort by boolean mask to get it so sort out the non-legend views.

You’re still doing the same thing where you sort the names without also sorting the elements. This means that when you filter the elements based on the names, you’re not actually using the correct name with the element. You can filter the Detail views first and then sort based on the name.

I got it. Thanks again. Now for the fun part to incorporate Data Shapes to it. :slight_smile:

1 Like