Sorting sheet list for export to Excel

Hi all !

I’ve got my Sheet list sorted by a discipline parameter and then by sheet number as you can see in the screenshot. However the sheet number sorts as a string and so sheet A-11.00 is placed first instead of after sheet A-9.00 … This is of course not like sorting a set of numbers since there is a mix of characters, punctuation and numbers in the same string. The string.tonumber node doesn’t work since it only converts the characters and drops everything else. I am looking for a node that will convert the whole string to hexadecimal so I can sort it and then convert back again. Just like this tool:
So far all I’ve found is limited to either numbers or characters, not both.

If anyone has a fix for this I’d be much obliged. I’m sure this would be helpful for a lot of other things too. I know lots of lists combine both. Numbering doors by room and apending A, B, C, D to the number for example.

Thanks !


Check out the Orchid package. I believe @erfajo has a couple ‘natural’ sorting nodes that may just help you.


By golly Sean ! That natural sorting totally works ! Now here’s the weird part. I’m trying to export my sheet list with the sheet number in one column and the corresponding sheet names in the next column. However, the result of my now naturally sorted list of sheet numbers is just the parameter values. It is not a sorted list of the actual elements. I need to be able to get the elements themselves in order to be able to get the names that match the numbers… and there is no logical way to sort those based on values alone. How do I get the elements to match my newly sorted list ?

Without some to look at it may be a bit hard to help, but perhaps you could upload one and we can help.

1 Like

Sounds like you need a dictionary for that. This is an OOTB feature in dynamo 2.

Try to build a dictionary where the keys are the sheet numbers (if you are sorting on those) and the item as the sheet names.

I was in the middle of posting to see if anyone had gotten this to work, then I got it to work! I’m posting my graph; if anyone see’s me doing something odd in this, please let me know. My next task is to add one more sorting parameter to the graph and I’m hoping I can do it.