Crystal XI
I am trying to calculate an average time.
I am sharing a datetimevar from a subreport to the main, called {@MainYardDate}:
WhilePrintingRecords;
Shared DateTimeVar SubYardDate ;
SubYardDate
Using the shared variable, I have created the following formula to calculate the datediff {@TimePerShipment}:
If datediff ('d', {@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})> 6 or
dayofweek ({@MainYardDate}) > dayofweek ({ACTUALRECEIVEDSHIPPEDDATETIME})then
numbervar diff:= datediff('s',{@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})/3600 - 30
else numbervar diff:= datediff ('s', {@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})/3600
When I try to save the following formula to caclulate the Average "TimePerShipment", I receive an error message that {@TimePerShipment} cannot be summarized.
NumberVar nbrTime := Average ({@TimePerShipment}, {IDMASTER_Consignee.IDENTITYID});
NumberVar nbrHour := Truncate(nbrTime);
NumberVar nbrHold := (nbrTime-nbrHour)*100;
nbrHold := (60*nbrHold)/100;
NumberVar nbrMinute := Truncate(nbrHold);
nbrHold:= (nbrHold-nbrMinute)*100;
NumberVar nbrSecond := Truncate(nbrHold*60)/100;
stringvar Output :=
ToText(nbrHour,0,"") + ":" + ToText(nbrMinute,0,"") + ":" + ToText(nbrSecond,0,"");
if instr(Output,"-") > 0 then
"(" & replace(Output,"-","") & ")"
else
Output
Why am I not allowed to summarize the {@TimePerShipment}? Is there a work-around for what I am trying to accomplish?
Thanks in advance for any help or suggestions!
Amy
I am trying to calculate an average time.
I am sharing a datetimevar from a subreport to the main, called {@MainYardDate}:
WhilePrintingRecords;
Shared DateTimeVar SubYardDate ;
SubYardDate
Using the shared variable, I have created the following formula to calculate the datediff {@TimePerShipment}:
If datediff ('d', {@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})> 6 or
dayofweek ({@MainYardDate}) > dayofweek ({ACTUALRECEIVEDSHIPPEDDATETIME})then
numbervar diff:= datediff('s',{@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})/3600 - 30
else numbervar diff:= datediff ('s', {@MainYardDate},{ACTUALRECEIVEDSHIPPEDDATETIME})/3600
When I try to save the following formula to caclulate the Average "TimePerShipment", I receive an error message that {@TimePerShipment} cannot be summarized.
NumberVar nbrTime := Average ({@TimePerShipment}, {IDMASTER_Consignee.IDENTITYID});
NumberVar nbrHour := Truncate(nbrTime);
NumberVar nbrHold := (nbrTime-nbrHour)*100;
nbrHold := (60*nbrHold)/100;
NumberVar nbrMinute := Truncate(nbrHold);
nbrHold:= (nbrHold-nbrMinute)*100;
NumberVar nbrSecond := Truncate(nbrHold*60)/100;
stringvar Output :=
ToText(nbrHour,0,"") + ":" + ToText(nbrMinute,0,"") + ":" + ToText(nbrSecond,0,"");
if instr(Output,"-") > 0 then
"(" & replace(Output,"-","") & ")"
else
Output
Why am I not allowed to summarize the {@TimePerShipment}? Is there a work-around for what I am trying to accomplish?
Thanks in advance for any help or suggestions!
Amy