Average datediff for Report Footer:
Crystal XI
SQL 2005
I am running into a roadblock trying to calculate
the average datediff in the report footer. And am
hoping for some assistance to do so.
I am successful calculating the average datediff in
Group Footer 1 using the following....
I am currently calculating the datediff:
datediff ('s', {@shared_ArrShip}, {@shared_DepShip}) / 3600
My 'shared' formulas are coded this way, because I have them displayed in
my GF2 (by Bill Number)...
{@shared_ArrShip}:
global datetimeVar ArrDate;
if {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.STATUS_CODE} = "ARRSHIP" then
ArrDate := {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.CHANGED};
ArrDate;
{@shared_DepShip}:
global datetimeVar DepDate;
if {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.STATUS_CODE} = "DEPSHIP" then
DepDate := {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.CHANGED};
DepDate;
I then go on to calculate an average for GF1 (by driver):
I am using a "reset" formula in GH1, I have an "accum"
formula suppressed in GF2, and finally I have a
display formula (my GF1 'average datediff') called 'display_GF1'
@resetgroup:
whileprintingrecords;
numbervar secs;
numbervar cnt;
if not inrepeatedgroupheader then (
secs := 0;
cnt := 0
);
@accum:
whileprintingrecords;
numbervar secs := secs + {@DateDiff};
numbervar cnt := cnt + 1;
@display_GF1:
whileprintingrecords;
numbervar secs;
numbervar cnt;
secs/cnt
Thanks, Amy
Crystal XI
SQL 2005
I am running into a roadblock trying to calculate
the average datediff in the report footer. And am
hoping for some assistance to do so.
I am successful calculating the average datediff in
Group Footer 1 using the following....
I am currently calculating the datediff:
datediff ('s', {@shared_ArrShip}, {@shared_DepShip}) / 3600
My 'shared' formulas are coded this way, because I have them displayed in
my GF2 (by Bill Number)...
{@shared_ArrShip}:
global datetimeVar ArrDate;
if {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.STATUS_CODE} = "ARRSHIP" then
ArrDate := {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.CHANGED};
ArrDate;
{@shared_DepShip}:
global datetimeVar DepDate;
if {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.STATUS_CODE} = "DEPSHIP" then
DepDate := {ZZ_ARRIVE_SHIP_VS_DEPART_SHIP;1.CHANGED};
DepDate;
I then go on to calculate an average for GF1 (by driver):
I am using a "reset" formula in GH1, I have an "accum"
formula suppressed in GF2, and finally I have a
display formula (my GF1 'average datediff') called 'display_GF1'
@resetgroup:
whileprintingrecords;
numbervar secs;
numbervar cnt;
if not inrepeatedgroupheader then (
secs := 0;
cnt := 0
);
@accum:
whileprintingrecords;
numbervar secs := secs + {@DateDiff};
numbervar cnt := cnt + 1;
@display_GF1:
whileprintingrecords;
numbervar secs;
numbervar cnt;
secs/cnt
Thanks, Amy