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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time sum

Status
Not open for further replies.

SDS100UK

MIS
Jul 15, 2001
185
GB
Hi, I have the following code in a field -

if PreviousIsNull ({VW_EVT_AGENT_PERF.EAP_STAFF}) OR
Previous ({VW_EVT_AGENT_PERF.EAP_STAFF}) <> {VW_EVT_AGENT_PERF.EAP_STAFF} OR
Previous ({VW_EVT_AGENT_PERF.EAP_SIGN_IN_TIME}) <> {VW_EVT_AGENT_PERF.EAP_SIGN_IN_TIME}
then
RISecondsToHMS ({VW_EVT_AGENT_PERF.EAP_TOT_SIGN_IN_TIME})
else
&quot;&quot;

This gives me the amount of time that an agent has spent in certain states, ie break lunch etc etc.

In a day they have 2 breaks and CR lists each break. What I want is the total for the breaks or in other words a sum of th etime according to the 'State' group that I have....but I cant get it to sum. It just keeps asking for a Number field.

Any ideas as to how I can achieve what I need??

Many many thanks in advance


Steven
 
Dates can not be summed up, but differences of dates can. Difference of two dates is expressed in number of days; it can be fractional.
 
Thanks Nagornyi,

Does it matter that my figures are times and not dates????


Steven
 
Crystal is based on SQL, which stores even dates in seconds. Within Crystal, you have to tell it to ignore the date or ignore the time if you don't want full date-time processing. Thus Datediff(&quot;h&quot;, timeone, timetwo) gives you the difference in hours. &quot;n&quot; is minutes, since &quot;m&quot; means months, and &quot;s&quot; is seconds

Madawc Williams
East Anglia, Great Britain
 
Madawc: Who told you that SQL databases store dates as seconds?

Some SQL databases have a DATE and DATETIME type, the latter is stored at the millisecond grnulairty, but generally not as milliseconds (algorithm). Date types are not stored as seconds, but in either case you'd need to know the database type and version, which is sadly omitted here, as is the Crystal version.

Steven: Post how this time is formatted, it can be summed, but we'll convert it to seconds or some such and then sum it, then display it however you need it.

I have a FAQ along those lines for part of it:

faq767-3543

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top