Sort Numbers as Numeric
Michael Mantkowski
michaelj at clientrax.com
Sat Jun 12 12:10:24 UTC 2021
Thanks Bas and Kelly!
Kelly's solution worked perfect. Easy peasy in one line.
I never realized you could work a calculation into the $sort like that.
Awesome!
*********************************************************************
Michael Mantkowski
ClienTrax Software
1-614-875-2245
*********************************************************************
-----Original Message-----
From: omnisdev-en On Behalf Of Kelly Burgess
Sent: Saturday, June 12, 2021 7:47 AM
To: OmnisList <omnisdev-en at lists.omnis-dev.com>
Subject: Re: Sort Numbers as Numeric
Hi Mike,
> I have a list of values in a character field like this.
>
> A1
> 2
> 1
> B2
> 20
> 12
>
> It Sorts like this.
>
> 1
> 12
> 2
> 20
> A1
> B2
>
> I want it to sort like this.
>
> 1
> 2
> 12
> 20
> A1
> B2
Instead of the normal sort, say with Do list.$define(val)...
# Do list.$sort($ref.val,kFalse)
prepend some zeros to the value and sort that:
Do list.$sort(jst($ref.val,'-3P0'),kFalse)
Kelly
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list