Problems with Sort Index by Value node


#1

I’m trying to sort some elements by their y,z positions but the sort index by value node doesn’t return the correct order of number values. Where am I doing wrong?


#2

I actually think the SortIndexByValue node does exactly what it’s supposed to do.
What is the result you’d want?


#3

I think it should assign “0” to the smallest number and “5” to the biggest one, but it does’nt do that.


#4

But 104137 is the smallest number and 104396 the largest aren’t they?
Do you want to sort the list based on values instead of getting the indices?


#5

Yes it’s correct, so why 104137 which is the smallest one returns “4” and 104396 which is the largest one returns “1”?
I think something is not working in the node.
I need indexes, I don’t want to sort elements. I just want to assign a progressive number to these elements.


#6

Aha, I see your problem.
You’re reading it quite the opposite way to what it’s doing.
With the first being 3, it means that the number at index 3 (so 104137) has the lowest value, and the highest value has index 2 (so 104369)


#7

Many thanks @PauLtus ! I just understood how the node works thanks to you.


#8

I’m actually fairly certain that if you put the result of the SortIndexByValue node through another SortIndexByValue node you’ll get the result you wanted :wink:


#9


Paul same thought here:wink:


#10

Great! That’s true. I resolved sorting elements by their positions and then assigning a progressive number, but I might as well use your solution.


#11

:wink:


#12

SortIndex