My thanks to IanWaterman for posting the following formula which seems to have solved the problem I've been struggling with. Of course, no sooner, is one problem solved and another comes along to fill the void! The result is rounded and I prefer to display two digits to the right of the decimal. What I'm getting is 3 (hours) and what I want is 3.75 (hours). I'd also appreciate if someone could explain what exactly the formula is doing and if in fact this is a workable solution to calculating the averagehours between a start date and an end date (@Preventive Hours-- datediff('h',{PREVENTIVE_MNT_V.START_DATE},{PREVENTIVE_MNT_V.END_DATE})). I'm attempting to learn how to utilize formulas in Crystal (other than copy and paste) and I'm trying to understand the why's and whatfor's. Crystal XI, SQL 2000 DB
Thanks!
whileprintingrecords;
local numbervar avtime:= average({@Preventive Hours},{EQUIPMENT_MNT_V.EQUIPMENT_ID});
local numbervar hour:= int(avtime/3600);
local numbervar min:= int((remainder(avtime,3600))/60);
local numbervar sec:= remainder(remainder(avtime,3600),60);
Thanks!
whileprintingrecords;
local numbervar avtime:= average({@Preventive Hours},{EQUIPMENT_MNT_V.EQUIPMENT_ID});
local numbervar hour:= int(avtime/3600);
local numbervar min:= int((remainder(avtime,3600))/60);
local numbervar sec:= remainder(remainder(avtime,3600),60);