sort integer negative values

0
Good Morning, I have a listview with a sort on Integer numbers. The numbers are 1,2,0,-1,-2 I did a sort on these numbers and it orders like this: -1     → wrong -2     → wrong 0 1 2 The -1 and -2 are switched? Why is it like this with negative numbers? and how can I fix this issue?   EDIT: it should first be -2 and THAN -1… because -2 < -1 < 0…   EDIT: When I do sort in nanoflow it does work, but not if I use sort in listview of page itself...   Kind regards, Steven Keersmaekers
asked
3 answers
2

It's interesting and a little counter-intuitive, but I guess it's sorted based on ascension. Where negative becomes more negative, and positive becomes more positive.

I would suggest sorting the negative list descending, and sorting the postive list ascending, and then merging the two.

[EDIT]

I can reproduce it in a listview in a native profile. It's gotta be a bug. Using a nanoflow as datasource does sort the list correctly.

answered
0

He Steven,

I tried it myself, for me the sorting seems to work. Am I doing something different from what you do?

    

answered
0

Hi Steven,

are you sure, that your attribute is of type Integer? The case your describing looks like your are sorting a String attribute, which would explain the “wrong” sort order. 

answered