Sort Problem

Hie,
i have a problem with sort dates. In the images, you can see the results sorted the same list. First, get it through a component and second with copy/paste in a Panel. With the first option “80” appear in 49th place but in the second apperars in the first place.


image
Check.gh (8.6 KB)

Regards.

so the way sort works is that it sorts in ascending order whatever you pass into keys. it applies the same reshuffle to what ever you pass into values

to exemplify, if you have:
keys [10, 5, 1, 7] and
values [a, b, c ,d] the sort changes the

keys to [1, 5, 7, 10] and
values to [ c, b, d, a ]

1 Like

Thanks so much!
I understand that you say but i don´t understand why sort function on diferent way in both routines.
Regards,

oh, i see what you mean. that’s because the two problematic panels are not lists, it’s a single string

to solve that, right click on the two panels and select multiline. but you’ll get an error since it expects the number of items in both lists to be identical

1 Like

Thanks. The number of item was a way to show that the order was differerent. Why the sort is different with multine that not?
Regards

without multiline, it interprets the panel as 1 string item
so you’re not really sorting anything.

to illustrate: imagine each space is a new line
[ “this is a string array” ] → has 1 item (or not multiline)

multiline separte each line into its own item
[ " this" , “is”, “a”, “string”, “array” ] → has 5 items

2 Likes

Clear! Thanks so much.

1 Like