Friday, October 25, 2013

Crystal Reports : Hours and Minutes from Minutes

Let us suppose we would like to summarize the amount of minutes in a phone call report, but express the grand total in hours and minutes. This is more easily accomplished using the "Display String" of the field in question. This allows us to create the summary field as normal.

1. Create a summary field to SUM your {CALLS.MINUTES} field
2. Right click on the summary field itself
3. Click on the "X-2"button to the right of "Display String"
4. Paste in the following formula :

local numbervar Hr := Truncate(CurrentFieldValue/60);

local numbervar Mn := Remainder(CurrentFieldValue,60);

Totext(Hr,0) + "Hours " + ToText(Mn,0) + "Minutes"

Pro Tip : The CurrentFieldValue function returns the current field value of the field being formatted. This allows easy code reuse.

1 comment:

Amardeep singh said...

hi justin, how do i access the videos from your blog. i have subscribed to marksgroup on youtube and have seen some videos you posted, but not able to find the videos that you have posted on your blog