Ordering List by Parameter Value (Sheet Number)

Hey guys!

I working on a code to export sheet data to excel (which I have working) but I am having a lot of trouble trying to re-order my list to be in order of sheet number (from lowest to highest) and not by the sheets index. I have been going around in circles trying to make this work.

My node setup prior to export currently goes:
list create > list.transpose > data export

and that spits out excel like the below:

Any help would be great! Though I know you can re arrange the list in excel but id like to have it embedded in the code

Node setup of the list for reference

image

use one of the values as a key.

but please upload you graph file as far as you have it by now, then it is easier to help you.

Are you pulling the data from schedules or categories?

Can you please explain a bit futher?

Sorry but here is a link to the graph file https://we.tl/t-MVosa0mG4X

I am pulling from categories as the image below shows. Does pulling the data from schedules change how the data would get sorted? Excuse my daftness

image

yes it does, (btw) your not daft apperently

I made a “dummy index” since I didnt have your sorting order… but this is how you can use one of the values as a sorting key…

Basic to Excel.dyn (37.8 KB)

1 Like

read this:

1 Like

thanks heaps!

I will need to do a bit of reading and figuring out to understand that list sort by key node but thank you for your help!!

well… I just added a integer project parameter named Index and then I gave the three sheets a random number from 1 to 3… this is why they come out unsorted from the getter node.

then is the two sorting nodes sorting the two lists and the one key list… combine those in the list create in the order by “index”

thats it :slight_smile:

1 Like

It works! The only sheet that gets lost in the fray is sheet 1000 which gets put after sheet 100 instead of at the end of the set, but having everything else in order makes it so much easier! thank you heaps for you help

image

this is a sorting issue… you need a Natural sort order node to fix that issue.

I have nodes for natural sorting

BUT… this is not a sortbykey function… maybe i should build such a node :slight_smile:

Ahhh! I had literally downloaded the Orchid package about 10 minutes before posting this. Will need to play around with the Natural sort order, and probably do a bit of research so I properly understand the different types of sort order.

Thank you so much for you help!