hi!
having issue with duration time in crystal report. i want to sum duration time

0:48
1:05
2:00
0:45

I want to sum the time in crystal report.The sum of the time should be 4:38 not 3:98. Please help.Thanks in advance

You need to break down the minutes from the seconds first, then calculate the seconds. If more than 60, convert to minutes. Calculate the minutes PLUS those carried over from seconds.:)

Have a look at THIS link on how to convert them....

thanks 4 the response..but i still cannot find the solution..i'm new in crystal report..so,i dunno how to use the function given..

my situation : Excel is my sources.And my sources is not in time..So that i convert the sources to time using this formula:

//time format
stringvar x := totext({Sheet1_.Duration});
time(0,val(left(x,2)),val(right(x,2)))

then, i want to calculate the duration time that need a result as my previous post.
I've tried several things, but can't seem to come up with the correct formula or combination of formulas that work. Any suggestions would be great!

You are using VB6 and Crystal Reports together, am I right?

If so, the result from your above code is then giving you a value in time i.e. "1:05" gives you one minute five seconds. For that reason the link in my previous post which will break down the 5 seconds from the 1 minute. It will do so with all the other results. The following will then calculate the seconds, convert to minutes and give a total result -

Dim xSec As Integer, xMin As Integer, xResult As Integer

xSec = Val(48) + Val(5) + Val(45) 'All the seconds broken down
xMin = Val(1) + Val(2) 'All the minutes broken down

'Convert seconds to minutes
If xSec => 60 And < 120 Then
   xSec = xSec - 60
   xMin = xMin + 1
ElseIf xSec => 120 And < 180
   xSec = xSec - 120
   xMin = xMin + 2
   'Do the same for all other more minutes
End If

xResult = xSec & ":" & xMin
xResult = Format(xResult, "mm:ss")

i'm using crystal report only and it give me 2 choices..which is use basic syntax or crystal syntax..if i use your formula,its error there : a variable type(for example,'string')is missing

so how?thanks

I am not at all versed in functions and naming conventions in Crystal Reports. The above code will however be the basic principles to use when calculating the sum. I have only used CR in my applications coding in VB6...:)

I saw that the "Integer" type for instance is called "Int" in CR....

Have a look at THIS link for more information and to "convert" the above code.

Sorry I can't be of more assistance.

thanks 4 ur sugestion :)..maybe i need do more r&d in crsyal report..

Good luck and happy coding.:)

If you find a solution, please paste it here for future members who might have the same problem.

If you are not going to use this thread anymore, please mark it as solved so it can be closed off, thanks.:)

This question has already been answered. Start a new discussion instead.