Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to Crystal - Hrs and mins total need to format

Status
Not open for further replies.

warrenkinetic

Programmer
Jul 26, 2005
1
ZA
Hi,

I have two totals in the report footer called hours and minutes. At the end of the report, the total hours is 3 and the total minutes is 500. How can I divide the minutes by 60 add that to Hours and the remainder stays as minutes?

Thanks
 
Assuming you have a total for Hours and a total for Minutes, you could try something like this:

1.) Create a formula that divides the total minutes by 60.
Whatever is left over will be the value for your Minutes column.

@Mins to hrs
Code:
local numbervar totmins := Sum ({@Minutes}) ;
Global numbervar mhrs ;
Local numbervar mins ;
mhrs := Truncate(totmins/60) ;
mins := totmins - (mhrs*60);

2.) Create a second formula to add the hours that you got from the previous formula to the total for the Hours column.
Code:
EvaluateAfter ({@Mins to hrs}) ;
Sum ({@Hours}) + Global Numbervar mhrs

3.) Suppress the Grand Totals that are currently on the report for the Hours and Minutes, and place these 2 new formulas there.


Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top