Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am designing crystal report with a column having time duration.

I have column like Empcode, name, duration, remarks, etc.

I am grouping report according to empcode.

I want to display sum of duration in group footer.

I have two formulae for that...

C#
 @get_seconds :
   local stringvar array completetime;
    local numbervar totalseconds;
    completetime:=split({DailyAttendance.TotalDuration},":");
    totalseconds:= (3600*cdbl(completetime[1])) + (60*cdbl(completetime[2]));

@total_duration :
   replace(cstr(Sum ({@get_seconds})\3600),".00","") 
   + ":" +  replace(cstr((Sum ({@get_seconds}) mod 3600)/60),".00","")

I am displaying @total_duration in group footer, but i am getting sum of all records in report, not sum of records in group only. Can someone tell me how to achieve this??

Thanks..
Posted
Updated 13-Oct-12 1:41am
v3

1 solution

Got my solution,
I just Updated my formula as:

@total_duration :
replace(cstr(Sum({@get_seconds}, {DailyAttendance.EmpCode})\3600),".00","")
+ " Hrs " + replace(cstr((Sum ({@get_seconds}, {DailyAttendance.EmpCode}) mod 3600)/60),".00","") + " Mins"

Thanks..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900