sorting - THANK YOU PAUL!!
Paul Hibbert
paulhibbert at mac.com
Sat Aug 9 13:04:54 EDT 2014
Sorry, I did miss the "numeric" sort, it worked with a short example, but using Colin's test script, this also works:
on mouseUp
sort lines of fld "sortField" numeric by word 2 of each
sort lines of fld "sortField" descending by word 1 of each
end mouseUp
Paul
On 2014-08-09, at 9:51 AM, Colin Holgate <coiin at verizon.net> wrote:
> I tried Craig’s approach, but with the correct syntax, not the condensed example he gave. I put your example list into field 1, and had this script in a button:
>
> on mouseUp
> put fld 1 into fld 2
> sort fld 2 by word 1 of each & word 2 of each
> end mouseUp
>
> I then scrambled (manually) the lines of field 1. That consistently gives back the list in the sorted order you showed.
>
> Next I tried this script:
>
> on mouseUp
> repeat with a = 1 to 100
> put item random(2) of "advanced,beginner" && random(100) into line a of fld 1
> end repeat
> put fld 1 into fld 2
> sort fld 2 by word 1 of each & word 2 of each
> end mouseUp
>
> Field 1 had a random list of advanced and beginner entries, with a level too, and after clicking the button field 2 showed the list as sorted.
>
> Now, it’s an alpha sort not a numeric sort, and Paul’s approach, which was the same as Björnke’s, also fails in that way.
>
> So, Craig’s suggestion was good, just not with the syntax expanded.
> _______________________________________________
> 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