Sort list based on sheet number with element ID

Hey!
Im trying to make a list of sheets which are in an assembly. This list should be filtered based on sheet number instead of element ID. The list in red is the list that needs to be sorted. The blue lists shows some ‘trial and errors’ , all without element id. Without element ID the output is not useful for the rest of my script.
I’m pretty sure it should be quit easy to fix, but I’m not sure how…

I hope someone can help me out!

Hi just send the data from Sheet.SheetNUmber (or something else) to List.SortByKey - Keys.

Thanks for your suggestion! However, i already tried to do that, but then the next input will be a string and not a sheet. The rest of my script doesn’t work with strings, only sheets :thinking:

Yes thats why you use Sheets (elements) in List input and Sheet.Numbers as keys :wink:
Sorted List outputs Sheets, Sorted Keys outputs sorted Sheet.Numbers.

Yess, but because I already filtered out all the sheets who are not in an assembly, the list with sheet numbers is longer than the list which needs to be sorted. I also tried to use this Sort by Key node before filtering out the other sheets, but that didn’t work either. Any other suggestions? :grin:

I don’t think you got how the Element.GetParameterValueByName and List.SortByKey work :stuck_out_tongue:

Plug your sheets to this node, and then this node to List.SortByKey :

Capture

Should’ve known that… Works now, thanks! :smiley:

Glad your figured it out !

I switched the solution to @Jan_Secnik’s post as he first described this solution :wink:

1 Like