How to sort numbers ignoring sign
How to sort numbers ignoring sign
mkhsam
Posts: 2Questions: 1Answers: 0
Hi. I have a column with numbers like this: [1, 2, 3, 11, -15, -4] and so on. It could be a positive or negative values. I would like to sort it with ignoring sign. As example I would like to get something like this after sorting my example:
[-15, 11, -4, 3, 2, 1] or [1, 2, 3, -4, 11, -15]? How to do that?
This question has an accepted answers - jump to answer
Answers
Use Orthogonal data. Use
columns.render
is shown in the Computed Values docs to return the unsigned number for thesort
operation.Kevin
Thanks, not clear how to return return the unsigned number for the sort operation and how it can sort in right order my values.
How it looks for me now:
What is wrong here?
toString()
wouldn't do it, you needMath.abs()
- see here :Colin