I need to find elapsed time between when a work order was requested and completed. Searching Tek-Tips I've found elegant solutions to this. (Thanks everyone!) However due to how our data is stored I need to combine a date field with a time field. A sample of the data is:
{WO.COMPLETIONDATE} data 09/05/2010 00:00:00 and
{WO.COMPLETIONTIME} data 01/01/1900 17:05:32
I trying to get {WO.COMPLETIONDATE} as 09/05/2010 17:05:32
I can join them as text strings
but then I have a string and can't perform the math to subtract REQUEST from COMPLETION
I'm getting a message that Crystal expects a number, datetime or boolian at the CDdateTime(dt)) point.
Thanks for any assistance. ~Bob~
{WO.COMPLETIONDATE} data 09/05/2010 00:00:00 and
{WO.COMPLETIONTIME} data 01/01/1900 17:05:32
I trying to get {WO.COMPLETIONDATE} as 09/05/2010 17:05:32
I can join them as text strings
Code:
Totext({WO.COMPLETIONDATE}, "dd/MM/yy") & Totext({WO.COMPLETIONTIME}, "HH:mm:ss")
Code:
stringvar dt := Totext({WO.COMPLETIONDATE}, "dd/MM/yy") & Totext({WO.COMPLETIONTIME}, "HH:mm:ss");
numbervar tsecs := datediff("s",{WO.REQUESTTIME},CDdateTime(dt)); // number of seconds between the dates
numbervar ndays := truncate(tsecs/86400); // divide by the seconds in a day
tsecs := remainder(tsecs,86400); // find the left over seconds
numbervar nhours := truncate(tsecs/3600); // divide by the seconds in an hour
// Code goes on to get minutes and seconds.
I'm getting a message that Crystal expects a number, datetime or boolian at the CDdateTime(dt)) point.
Thanks for any assistance. ~Bob~