Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Total Seconds formula help Post Reply Post New Topic
Author Message
nhopp4
Groupie
Groupie


Joined: 03 Oct 2012
Location: United States
Online Status: Offline
Posts: 62
Quote nhopp4 Replybullet Topic: Total Seconds formula help
     Posted: 30 Oct 2012 at 2:39am
I think ive noticed something wrong with my Total Seconds formula and I want to run it passed an expert if I could.  Its part of a multiple formula report so I think I am not calculating it right.
 
//Starttime Formula
DateTimeVar StartTime;
If {Reports_Events.Type} = 'start' then StartTime := {Reports_Events.Timestamp};
StartTime
 
 
//Duration Formula
If {Reports_Events.Type} = 'Stop' Then DateDiff('s',{Reports_Events.Timestamp}, {@startTime})
 
//Convert to positive.  For some reason some of my numbers were negative when the duration all should be positive.
if {@duration} < 0 then ({@duration} *-1);
 
//TotalSeconds formula
local NumberVar TotalSecs;
TotalSecs:= {@ConvertToPositive}
 
My cross tab is pulling the sum of TotalSeconds.  I think that it could only be pulling the negative numbers converted to a positive.  Is there a formula I can use to Add the negative numbers after they have been converted and the duration that are already positive?
 
Thanks guys!
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 30 Oct 2012 at 8:57am
if {@duration} < 0 then ({@duration} *-1) else {@duration}
HTH
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum