Sort IP List

Mike Bonner bonnmike at gmail.com
Fri Jun 29 18:00:20 EDT 2018


Thx for the clue, I see what you mean.

I had tried to get something similar to your value(item 1 of each +0)
method to work and something wasn't clicking, but after seeing yours, I
think I have it working.

sort lines of tList ascending numeric by (item 1 of each +0) & (item 2 of
each + 0) & (item 3 of each + 0) & (item 4 of each + 0)

The above seems to work fine (and I avoided using value() to avoid an
unnecessary function call), you just have to remember to set the
itemdelimiter to "." otherwise you get the error.  This may be faster
because there aren't a bunch of function calls like my first idea, though
I'm not sure how overhead compares since the numbers must still be
evaluated.

Just did some testing and it seems to be way way faster.  100k lines sort
in 3/4 of a second.

On Fri, Jun 29, 2018 at 3:18 PM Bob Sneidar via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Yeah, no I get runtime error. <sigh>
>
> > On Jun 29, 2018, at 14:09 , Bob Sneidar via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> >
> > Yes because your ampersand operator is not passing different arguements,
> it's concatenating the items together so that 10.2.245.6 produces the
> integer 1022456. But 10.22.2.6 produces 102226 which is smaller, but ought
> to sort higher. Hence the 4 pass sort.
> >
> > But you got me thinking, what if you did something like:
> >
> > set the numberformat to "000"
> > sort lines of tIPList numeric by \
> >   value(item 1 of each +0) & \
> >   value(item 2 of each +0) & \
> >   value(item 3 of each +0) & \
> >   value(item 4 of each)
> >
> > Bob S
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list