Bill,

That worked perfectly, but now I have a problem reducing the number
of decimal places with the following code.

set VAR Ravgmchdt = (brnd(.avgmchdt, 5, .1))

Please let me know what you think.

Thanks

Steve


Total Code Listed Below
___________________________________________________________________________

-- avgmchdt.rmd
-- calculates the average mechanical down time for all +
-- customers for a selected date range

   set mess off
   set err mess off
   set null ' '
   CLS
   SET VAR pastday INTEGER
   SET VAR totldat INTEGER
   SET VAR vday1 DATE
   SET VAR vday2 DATE

   CLS
   WRITE ' '
   write '   DOWN TIME REPORT FOR ALL BREAKDOWNS SUMMARY AND DETAIL'
   WRITE ' '
   WRITE '   DATA CAN BE EXPORTED TO A EXCEL SPREAD SHEET OR PRINTED'
   WRITE ' '
   WRITE ' HIT ANY KEY TO CONTINUE '
   PAUSE
   WRITE ' ENTER BEGINNING AND ENDING DATES'
   run getdat1 USING 8
      if vrcode <> 0 then
      goto FINISH
   endif
   set var vday1 = .vstart_date
   set var vday2 = .vend_date
   set time format hh:mm:ss
   set var vtime_start = .#time
   run setprint.rmd
   CLS
   write ' '
   write ' '
   write '         DOWN TIME REPORT FOR ALL BREAKDOWNS REPORT -- PRINTED
ON', .#DATE
   write ' '
   WRITE '                     START DATE: ', .VDAY1
   WRITE '                       END DATE: ', .VDAY2
   write ' '
   WRITE ' '

   WRITE ' '


   sel average(timein-drivtime) from master where billstat ne 'nc' and +
   breakdat between .vday1 and .vday2
   Write ' '
   Write ' '


-- Old bad code below - take out later
--   set VAR avgmchdt = compute average(timein-drivtime) from master where
billstat ne 'nc' and +
--   breakdat between .vday1 and .vday2

   SET VAR vavgmchdt DOUBLE
   SELECT AVG (timein - drivtime) INTO vavgmchdt +
   FROM master +
   WHERE billstat <> 'NC' +
   AND breakdat BETWEEN .vday1 AND .vday2


-- This code temporary to display results of above command - works great due
to assistance
-- from Bill Downall
   Write ' '
   Show var vavgmchdt
   Write ' '


   set VAR Ravgmchdt = (brnd(.avgmchdt, 5, .1))
-- seem to be the expression above can not be evaluated


-- This code temporary to display results of above command

   Write ' '
   Show var RAVGMCHDT
   Write ' '


   Write 'AVERAGE DOWN TIME FOR ALL BREAKDOWNS FOR PERIOD
SELECTED: ----------- ' .RAVGMCHDT



____________________________________________________________________________
_________________


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Bill
> Downall
> Sent: Sunday, February 16, 2003 4:30 PM
> To: RBASE-L Mailing List
> Subject: [RBASE-L] - Re: Reducing the number of decimal places
>
>
> On Sun, 16 Feb 2003 16:19:14 -0500, Steve Breen wrote:
>
> >set VAR vAvgmchdt = sel average(timein-drivtime) from master where
> +
> >   billstat ne 'nc' and breakdat between .vday1 and .vday2
> > set var = (brnd(.vAvgmchdt, 5, .1))
>
> Steve, you have some syntax errors here. You're sort of combining the
> old 2.11 way to do it with the SQL way to do it. Then, your second
> SET VAR command has no variable named in it!
>
> I suggest:
>
> SET VAR vavgmchdt DOUBLE
> SELECT AVG (timein - drivtime) INTO vavgmchdt +
>   FROM master +
>   WHERE billstat <> 'NC' +
>   AND breakdat BETWEEN .vday1 AND .vday2
>
> Bill

Reply via email to