2 points by remi-quentin_92 11 months | flag | 2 comments
remi-quentin_92 11 months | flag

If you want to rank in decreasing order, you can either:

1 - scan with a minus sign


table T = with
[| as N |]
[| 0 |]
[| 1 |]
[| 2 |]
[| 3 |]

T.rk = rank() scan -T.N

show table "" a1b4 with
T.N
T.rk

2 - Use rankrev function (not documented but similar to rank function)


table T = with
[| as N |]
[| 0 |]
[| 1 |]
[| 2 |]
[| 3 |]
 
// equivalent to rank() scan -T.N
T.rk = rankrev() scan T.N
 
show table "" a1b4 with
T.N
T.rk

remi-quentin_92 3 weeks ago | flag

Update : rankrev will be deprecated long term.
Best practice is to use rank() scan [T.N desc]
Using keyword desc enables using any sortable type while a minus sign would not.