Crystal Ver 9
ODBC - AS400
I have a report showing records from a certain time period. Here is the output
Bus No Date WO NO Meter Diff
001 08/05/2005 xxxx 187019 00
Group Footer Bus No Count Avg 00
Bus No Date WO NO Meter Diff
002 07/18/2005 xxxx 218816 00
002 07/20/2005 219680 864
002 08/30/2005 228755 9075
002 09/07/2005 230513 1758
002 Count 4 Avg 3899
and so on
Report Footer Fleet Avg XXXXX
My problem is that i want to calculate avg between 07-09 however i don't want to start the counter with zero.
I want my report to pick previous record ( that is last road call happened prior to july) This way i will have correct pic.
Here are the formulas
Diff/ to calculate differnce)
IF {FM_300L2.FMASET} = PREVIOUS({FM_300L2.FMASET}) THEN
(
if {FM_300L2.FMPMR} >= PREVIOUS({FM_300L2.FMPMR}) then
{FM_300L2.FMPMR}- PREVIOUS({FM_300L2.FMPMR}) else
{FM_300L2.FMPMR}
)
ELSE
0
To calculate avg.
whileprintingrecords;
numbervar summiles;
numbervar counter;
numbervar grtotmiles :=grtotmiles + summiles;
numbervar grtotcnter :=grtotcnter + counter;
if counter > 0 then summiles/counter else 0
To calculate Fleet Avg
whileprintingrecords;
numbervar grtotmiles;
numbervar grtotcnter;
if grtotcnter > 0 then
grtotmiles/grtotcnter else 0;
Thanks
ODBC - AS400
I have a report showing records from a certain time period. Here is the output
Bus No Date WO NO Meter Diff
001 08/05/2005 xxxx 187019 00
Group Footer Bus No Count Avg 00
Bus No Date WO NO Meter Diff
002 07/18/2005 xxxx 218816 00
002 07/20/2005 219680 864
002 08/30/2005 228755 9075
002 09/07/2005 230513 1758
002 Count 4 Avg 3899
and so on
Report Footer Fleet Avg XXXXX
My problem is that i want to calculate avg between 07-09 however i don't want to start the counter with zero.
I want my report to pick previous record ( that is last road call happened prior to july) This way i will have correct pic.
Here are the formulas
Diff/ to calculate differnce)
IF {FM_300L2.FMASET} = PREVIOUS({FM_300L2.FMASET}) THEN
(
if {FM_300L2.FMPMR} >= PREVIOUS({FM_300L2.FMPMR}) then
{FM_300L2.FMPMR}- PREVIOUS({FM_300L2.FMPMR}) else
{FM_300L2.FMPMR}
)
ELSE
0
To calculate avg.
whileprintingrecords;
numbervar summiles;
numbervar counter;
numbervar grtotmiles :=grtotmiles + summiles;
numbervar grtotcnter :=grtotcnter + counter;
if counter > 0 then summiles/counter else 0
To calculate Fleet Avg
whileprintingrecords;
numbervar grtotmiles;
numbervar grtotcnter;
if grtotcnter > 0 then
grtotmiles/grtotcnter else 0;
Thanks