Sorting negative & positive numerical values

MP3Tag v3.00

Hello,
How to sort ascending a column that has positive and negative values so the result would go from negative to positive?

Here is the column definition:
name: ReplayGain-tr
Value: $replace(%REPLAYGAIN_TRACK_GAIN%, dB,)
Field: %REPLAYGAIN_TRACK_GAIN%
Sort by: $replace(%REPLAYGAIN_TRACK_GAIN%, dB,)

Notes: I remove the "dB" so I do a numerical sort. I tried with and without = same result.

It's a bit ackward:
a. the sort does not see the negative sign
b. it sort the integer portion ascending from 0 to 9, then sorts the fractional portion descending

My objective: sort the field so it goes from biggest negative, to zero, then to the biggest positive (like in a spreadsheet)

Thank you for any assistance.
Regards

screenshot_0

Sort by $num($replace(%REPLAYGAIN_TRACK_GAIN%,'.',),1) should do the trick.

1 Like

Hello Mister Florian :slight_smile:

Thx for your superQuick reply...

The $num did not do much, BUT removing the decimal point solved it :smiley:
So here is the final version:
$replace(%REPLAYGAIN_TRACK_GAIN%, dB,,.,)
So "-0.05 dB" becomes -> "-005"
then the sort is negative>>>0>>>positive.

Thank you again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.