No subject
Howard Bornstein
howard.bornstein at gmail.com
Fri Apr 1 12:42:40 EST 2005
On Mar 29, 2005 10:15 AM, Melitón Cardona Torres <toncardona at mac.com> wrote:
> I have this in a field:
>
> IPAE 16
> IPAE 1
> IPAE 7
> LAG 1
> JKAL 3
> JKAL 11
> JKAL 2
>
> and I wish to get this (same alphabetical order, sorted numeric by
> second word of each):
>
> IPAE 1
> IPAE 7
> IPAE 16
> LAG 1
> JKAL 2
> JKAL 3
> JKAL 11
>
> I would be grateful for your suggestions.
>
> Thanks in advance
>
> Ton Cardona
>
Here's a quick and dirty solution. Assume the data is in a filed
"data" and you have a button to do the sort. Use this handler in the
button.
on mouseUp
put fld "data" into dataholder
put the number of lines of dataholder into linecnt
repeat with i = 1 to linecnt
if word 1 of line i-1 of dataholder <> word 1 of line i of dataholder then
put line i of dataholder&return after sorter
end if
if word 1 of line i+1 of dataholder = word 1 of line i of dataholder then
put line i+1 of dataholder&return after sorter
else
sort lines of sorter numeric by word 2 of each
put sorter after sorteddata
put empty into sorter
end if
end repeat
put sorteddata into fld "data"
end mouseUp
--
Regards,
Howard Bornstein
-----------------------
www.designeq.com
More information about the use-livecode
mailing list