Sort problem

Jan Schenkel janschenkel at yahoo.com
Tue Sep 10 10:26:01 CDT 2002


Hi Yves,

You could try something like this:

set the useSystemDate to true
set itemdel to tab
# push the lines with the same date together
repeat for each line tLine of my_var
  if item 1 of tLine is not a date then
    put "@#@#" & tLine after tPrepVar
  else
    put return & tLine after tPrepVar
  end if
end repeat
put char 2 to -1 of tPrepVar into my_var
# now do the sorting on our squished variable
sort lines of my_var descending dateTime \
by item 1 of each
# and unsquish the result onto separate lines
replace "@#@#" with return in my_var
# the end...

Hope this helped,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (De Rochefoucald)

--- Yves Coppé <yvescoppe at skynet.be> wrote:
> Hi,
> 
> 
> 
> I have a variable (my_var) I want to sort
> 
> my script is :
> 
> 
> set the useSystemDate to true
> set itemdel to tab
> sort lines of my_var descending dateTime by item 1
> of each
> 
> 
> 
> but sorted myVar is something like this :
> 
> (Continental date format !)
> 
> 04/09/2002&tab&xxx&tab&yyy&tab&zzz
> 03/09/2002&tab&xxx&tab&yyy&tab&zzz
>             tab&xxx&tab&yyy&tab&zzz
> 02/09/2002&tab&xxx&tab&yyy&tab&zzz
>             tab&xxx&tab&yyy&tab&zzz
>             tab&xxx&tab&yyy&tab&zzz
> 01/09/2002&tab&xxx&tab&yyy&tab&zzz
> 
> 
> I'd like to sort my_var but the number of lines for
> each date record 
> is variable !!
> 
> How can I proceed ??
> 
> Thank you.
> -- 
> Greetings.
> 
> Yves COPPE
> 
> Email : yvescoppe at skynet.be
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
>
http://lists.runrev.com/mailman/listinfo/use-revolution


__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute



More information about the use-livecode mailing list