No subject
Éric Chatonet
eric.chatonet at wanadoo.fr
Tue Mar 29 12:55:57 EST 2005
Hi ton,
If your "non alphabetical order" is not an error (and I think so :-)
And assuming that series are always contiguous, you could try this:
on SortMyOddList
local tList,tLineNo,tFirstChar,tMax
-----
put fld "MyField" into tList
put 1 into tLineNo
put char 1 of tList into tFirstChar
put the number of lines of tList into tMax
-----
repeat with i = tLineNo to tMax
if char 1 of line i of tList <> tFirstChar then
sort line tLineNo to (i-1) of tList numeric by word 2 of each
put i into tLineNo
put char 1 of line tLineNo of tList into tFirstChar
end if
end repeat
sort line tLineNo to tMax of tList numeric by word 2 of each
-----
put tList into fld "MyField"
end SortMyOddList
The trick is simple but often useful: instead of 1 in the repeat
structure (repeat with i = 1...), you use a variable that you set first
and redefine later inside the loop. By this way you process separatly
chunks picked in the list... and keep your "same alphabetical order"
;-)
Best regards,
Le 29 mars 05, à 17:50, Cardona Torres<toncardona at mac.com> a écrit :
> 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
Eric Chatonet.
----------------------------------------------------------------
So Smart Software
For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch
----------------------------------------------------------------
Web site http://www.sosmartsoftware.com/
Email eric.chatonet at sosmartsoftware.com/
Phone 33 (0)1 43 31 77 62
Mobile 33 (0)6 20 74 50 86
----------------------------------------------------------------
More information about the use-livecode
mailing list