Problems with Sort Index by Value node

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?

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

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

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?

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.

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)

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

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:

1 Like

Paul same thought here:wink:

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.

1 Like