Dumb sort question
J. Landman Gay
jacque at hyperactivesw.com
Wed Dec 4 15:35:01 EST 2002
On 12/4/02 12:26 PM, jbv wrote:
> But how can I sort a variable featuring 4 lines with several
> hundreds of items in each, so that (for instance) items of
> line 4 are sorted numeric ascending, and (that's important)
> items of other lines being moved according to the new
> position of each item of line 4 ?
On second thought, this is probably faster and cleaner:
local theCount,theOldOrder
on dosort
put fld 1 into theData
put line 1 of theData into theOldOrder -- key line
put theOldOrder into theNewOrder
sort items of theNewOrder ascending numeric
put theNewOrder & return into theNewData
delete line 1 of theData
repeat for each line l in theData
put 0 into theCount
sort items of l by mySort(each)
put l & return after theNewData
end repeat
put theNewData into fld 2
end dosort
function mySort
add 1 to theCount
return item theCount of theOldOrder
end mySort
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the metacard
mailing list