sorting advice

Nicolas Cueto niconiko at gmail.com
Fri Jun 19 01:56:58 EDT 2009


Well, I found a solution. But maybe
someone's got something more
elegant.

Here's mine:

    repeat for each line tLine in tNaiyo -- the list of data, unsorted
        put word 2 of tLine && word 1 of tLine & cr after tSwitched
    end repeat
    delete the last char of tSwitched
    put tSwitched into tNaiyo
    put the itemdel into tSavedDel
    set the itemdel to "."
    sort lines of tNaiyo ascending numeric by item 2 of each
    sort lines of tNaiyo ascending numeric by item 1 of each
    sort lines of tNaiyo ascending numeric by item 3 of each
    put empty into tSwitched
    repeat for each line tLine in tNaiyo
        put word 2 of tLine && word 1 of tLine & cr after tSwitched
    end repeat
    delete the last char of tSwitched
    put tSwitched into tNaiyo -- the list of data, sorted by date
    set the itemdel to tSavedDel

Cheers,
Nicolas Cueto



More information about the use-livecode mailing list