dates count

Ken Ray kray at sonsothunder.com
Mon Nov 18 13:42:01 EST 2002


Yves,

How about something like this (you'll need a field "ResultFld" to see the
result):

on mouseUp
  breakpoint
  put fld "dates" into tDates
  put last word of the long date into thisYear
  put 1 into lineCounter
  put "" into retVal
  put thisYear into currYear
  repeat with x = (thisYear-9) to 1 step -10
    put "From " & x & " to " & currYear & ":" into tTemp
    put 0 into tCount
    repeat for each line y in tDates
      if y >= x then
        add 1 to tCount
      else
        exit repeat
      end if
    end repeat
    delete line 1 to tCount of tDates
    put tCount after tTemp
    put tTemp into line (the number of lines of retVal)+1 of retVal
    put x-1 into currYear
  end repeat
  put retVal into fld "ResultFld"
end mouseUp

-- Modify to suit your needs...

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/


----- Original Message -----
From: "yves COPPE" <yvescoppe at skynet.be>
To: <use-revolution at lists.runrev.com>
Sent: Monday, November 18, 2002 7:17 AM
Subject: dates count


> Hello,
>
> I have a fld "dates" with a list of years sorted descending:
> (the list has more than 1000 lines)
> ...
> 2002
> 2002
> 2001
> 1997
> 1997
> 1995
> 1994
> ...
>
> I'd like to know how much dates per 10 years
>
> 00-10 : 75
> 11-20 : 58
> ...
> ...
>
>
> here is my script :
>
> on mouseUp
>    put fld "dates" into tDates
>    put the short date into toDay
>    convert toDay to dateItems
>    put item 1 of toDay into thisYear
>    put "0" into a
>    put thisYear-10 into thisYear
>    put empty into tResult
>     repeat for each line L in tDates
>      if L " thisYear then
>        add "1" to a
>      else
>        put a&cr after tResult
>        put "1" into a
>        put thisYear-10 into thisYear
>      end if
>    end repeat
>    answer tResult
> end mouseUp
>
> but my result "tResult" is not correct
>
> can anyone help me ???
> --
> 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
>




More information about the use-livecode mailing list