sorting - THANK YOU PAUL!!
Colin Holgate
coiin at verizon.net
Sat Aug 9 12:51:56 EDT 2014
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.
More information about the use-livecode
mailing list