Re-orgranize a list of sheet instances using sheet number parameter (A-9,A-10,A-11, etc...)

So I used List.SortByFunction and managed to successfully sort a list of sheet instances by name. Only problem it sorts them as a string, so sheets A-10 through A-19 between sheets A-1 and A-2. This kind of cornered me in, because need the actual sheet instances to be arranged in that list, so I can make modifications to those sheets later on.

I looked into List.SortBykey but that only seemed to work with integers.


Any ideas?

I would prefer to do it without any extra packages but if I have to it will do.

this is a way:

at index 16 and 17 you can see they are on the right place. (not directly underneath index 11)
image

This gave me same result as List.SortByKeyFunction. Im pretty sure if I change A-1, A-2, A-3 to A-01, A-02, and A-03 I would get the result I need, but our office omits the 0. Any other ideas?

Only way I can think off is a crazy python script which would extract sheet number, extract an integer from the SheetNumber string. Then re-arrange in numerical order and at same time keep track of all of the indexes moved around, and then re-arrange actual sheet instances in a list based on indexes from the numerical order earlier. This is only way I can think off, but I just recently started playing around dynamo and python. Doing this seems like madness and I am really hoping for a better way of doing this.

Edit: I actually had a random light bulb but not sure if possible with “less madness.” Basically I could take all of the single digits sheets, add a temporary 0 in front of the number. Then go do my thing with my dynamo graph, and then go back and remove those 0’s. Not quite sure how I can do that, but one thing that I feel would problematic is that dynamo likes to run all of the branching off functions at the same time, and it does not care about IF nodes when comes to functions (atleast for me, it runs function I put in the ‘true input’ even if the condition is false. IF node works completly fine with numerical expressions though.) Way I avoided this problem so far is via python scripts, but I am not an advanced user, and feel I would have better luck with design script. I played with the transaction nodes too but don’t think I can achieve what I want to either.

Basically I need some guidance from some wizards :face_with_head_bandage: