Author |
Message |
Greg Berthum #1 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a STRING(5)
gsTimeBetween returns the time elapsed as HH:MM in a string. I'm trying to deformat the string into a Clarion time value. If the time elapsed is 1 hour or greater the deformat works else not. For example, 00:29 returns a Clarion value of 54001 and the time elapsed displays as 00:09 What am I doing wrong? Thanks! Greg Berthume Berthume Software www.berthume.com | www.cptracker.net cpTracker - Contact Management | Project Management | Bug Tracking | Email Tools | Sales Tracking
|
Sun, 06 Nov 2005 23:12:53 GMT |
|
 |
Faron Dun #2 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Greg, this code is not for Gcal, but I use it to calculate travel time, and on job time in a service dispatching program. It works perfect. ! calculate ElapsedTIme ! Elapsed time in 1/100ths of seconds IF GLO:CUST > 0 ET# = (CLOCK() - CAL:Arrived) +1 ET# = INT(ET# / 100) ! Whole seconds now... Hours# = INT(ET# / 3600) ! Extract any hours ET# -= Hours# * 3600 ! Reduce to just minutes/seconds Minutes# = INT(ET# / 60) ! Extract any minutes ET# -= Minutes# * 60 ! Just seconds remain in ET# now... IF CAL:Arrived = '' SiteTime = '00:00:00' ELSE
END !IF Cal:Arrived ! calculate ElapsedTIme ! Elapsed time in 1/100ths of seconds IF CAL:Arrived = '' ET# = (CLOCK() - CAL:AsignedCall) +1 ELSE ET# = (CAL:Arrived - CAL:AsignedCall) +1 END ET# = INT(ET# / 100) ! Whole seconds now... Hours# = INT(ET# / 3600) ! Extract any hours ET# -= Hours# * 3600 ! Reduce to just minutes/seconds Minutes# = INT(ET# / 60) ! Extract any minutes ET# -= Minutes# * 60 ! Just seconds remain in ET# now... !IF CAL:Arrived = '' !ElapsedTime = '00:00:00' !ELSE
ELSE SiteTime = '00:00:00' ElapsedTime = '00:00:00' END !END !IF CAL:Arrived HTH Faron Dunn
Quote: > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > STRING(5)
> gsTimeBetween returns the time elapsed as HH:MM in a string. > I'm trying to deformat the string into a Clarion time value. > If the time elapsed is 1 hour or greater the deformat works else not. > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > displays as 00:09 > What am I doing wrong? > Thanks! > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
|
Mon, 07 Nov 2005 02:50:05 GMT |
|
 |
Bob Dobbin #3 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Greg, Here is what I tested on C5.5G and it returns the correct values for 00:29 and 10:29. TimeValue LONG TimeString STRING(5) TimeString = '00:29'
message(...code to display both values) TimeValue at this point = 174001 TimeString = '10:29'
message(...code to display both values) TimeValue at this point = 3774001 I don't see anything wrong with your code. HTH, Bob Dobbins
Quote: > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > STRING(5)
> gsTimeBetween returns the time elapsed as HH:MM in a string. > I'm trying to deformat the string into a Clarion time value. > If the time elapsed is 1 hour or greater the deformat works else not. > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > displays as 00:09 > What am I doing wrong? > Thanks! > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
|
Sun, 06 Nov 2005 23:52:23 GMT |
|
 |
David Bratovic #4 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Hello Greg, If lTimespent is declared as...
Your code will work... If lTimespent is declared as... lTimeSpent String(5) Change...
to... CPL:TimeSpent = lTimeSpent ! CPL:TimeSpent is a LONG Since lTimeSpent is a String(5) it will not store a value larger than about 16 2/3 minutes. How is lTimeSpent declared? HTH Dave Bratovich
Quote: > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > STRING(5)
> gsTimeBetween returns the time elapsed as HH:MM in a string. > I'm trying to deformat the string into a Clarion time value. > If the time elapsed is 1 hour or greater the deformat works else not. > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > displays as 00:09 > What am I doing wrong? > Thanks! > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
|
Mon, 07 Nov 2005 00:11:32 GMT |
|
 |
David Bratovic #5 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
The problem is that the gsTimeBetween() function returns '54001' not '00:29' to the STRING. This can now be passed to the LONG without using DEFORMAT. If the string had a value of '00:29', it could then have DEFORMAT() applied to it. To use the STRING in this way it would have to be declared as a STRING(7) so it could be large enough to store the full number of Clarion ticks (1/100th of a second) in a day (846000). Dave Bratovich
Quote: > Greg, > Here is what I tested on C5.5G and it returns the correct values for 00:29 > and 10:29. > TimeValue LONG > TimeString STRING(5) > TimeString = '00:29'
> message(...code to display both values) > TimeValue at this point = 174001 > TimeString = '10:29'
> message(...code to display both values) > TimeValue at this point = 3774001 > I don't see anything wrong with your code. > HTH, > Bob Dobbins
> > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > > STRING(5)
> > gsTimeBetween returns the time elapsed as HH:MM in a string. > > I'm trying to deformat the string into a Clarion time value. > > If the time elapsed is 1 hour or greater the deformat works else not. > > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > > displays as 00:09 > > What am I doing wrong? > > Thanks! > > Greg Berthume > > Berthume Software > > www.berthume.com | www.cptracker.net > > cpTracker - Contact Management | Project Management | Bug Tracking | Email > > Tools | Sales Tracking
|
Mon, 07 Nov 2005 01:40:41 GMT |
|
 |
David Bratovic #6 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Opps Typo! in a day (846000). S/B in a day (8460000).
Quote: > The problem is that the gsTimeBetween() function returns '54001' not '00:29' > to the STRING. This can now be passed to the LONG without using DEFORMAT. If > the string had a value of '00:29', it could then have DEFORMAT() applied to > it. To use the STRING in this way it would have to be declared as a > STRING(7) so it could be large enough to store the full number of Clarion > ticks (1/100th of a second) in a day (846000). > Dave Bratovich
> > Greg, > > Here is what I tested on C5.5G and it returns the correct values for 00:29 > > and 10:29. > > TimeValue LONG > > TimeString STRING(5) > > TimeString = '00:29'
> > message(...code to display both values) > > TimeValue at this point = 174001 > > TimeString = '10:29'
> > message(...code to display both values) > > TimeValue at this point = 3774001 > > I don't see anything wrong with your code. > > HTH, > > Bob Dobbins
> > > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > > > STRING(5)
> > > gsTimeBetween returns the time elapsed as HH:MM in a string. > > > I'm trying to deformat the string into a Clarion time value. > > > If the time elapsed is 1 hour or greater the deformat works else not. > > > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > > > displays as 00:09 > > > What am I doing wrong? > > > Thanks! > > > Greg Berthume > > > Berthume Software > > > www.berthume.com | www.cptracker.net > > > cpTracker - Contact Management | Project Management | Bug Tracking | > Email > > > Tools | Sales Tracking
|
Mon, 07 Nov 2005 01:42:34 GMT |
|
 |
Greg Berthum #7 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Quote: > The problem is that the gsTimeBetween() function returns '54001' not '00:29' > to the STRING.
It's returning a string: Function: gsTIMEBETWEEN(LONG,<<LONG>,<<BYTE>),STRING Syntax: MyField = gsTIMEBETWEEN(MyTime,<<MyTime2>,<<Return Option>) Returns: Elapsed Time Purpose: Get elapsed time If parameter 2 is omitted, defaults to current time. Option (1=Hours, 2=Minutes, Else Hours:Minutes) What gsTimeBetween() are you referring to? Mine is from gCAL from Gitano. Greg
|
Mon, 07 Nov 2005 02:43:31 GMT |
|
 |
Greg Berthum #8 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Quote: > If lTimespent is declared as...
> Your code will work...
I changed the declaration to this and I get the same results. Quote: > If lTimespent is declared as... > lTimeSpent String(5) > Change...
> to... > CPL:TimeSpent = lTimeSpent ! > CPL:TimeSpent is a LONG
Doesn't work. In my test, I have a start time of 05:46 PM and an end time of 06:21 PM gsTimeBetween returns 0:35 as a string value, not a Clarion time value. The conversion to Clarion time value is 30001 and it displays as 00:05 Greg
|
Mon, 07 Nov 2005 02:57:02 GMT |
|
 |
Greg Berthum #9 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
The problem is that gTimeBetween() is returing 0:00 and not 00:00 and therefore the conversion to Clarion time value is coming out incorrect. Greg Berthume Berthume Software www.berthume.com | www.cptracker.net cpTracker - Contact Management | Project Management | Bug Tracking | Email Tools | Sales Tracking
Quote: > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > STRING(5)
> gsTimeBetween returns the time elapsed as HH:MM in a string. > I'm trying to deformat the string into a Clarion time value. > If the time elapsed is 1 hour or greater the deformat works else not. > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > displays as 00:09 > What am I doing wrong? > Thanks! > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
|
Mon, 07 Nov 2005 03:32:57 GMT |
|
 |
David Bratovic #10 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
I don't use gTimeBetween(), I knew that the problem had to be in what the function was returning. db
Quote: > The problem is that gTimeBetween() is returing 0:00 and not 00:00 and > therefore the conversion to Clarion time value is coming out incorrect. > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
> > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > > STRING(5)
> > gsTimeBetween returns the time elapsed as HH:MM in a string. > > I'm trying to deformat the string into a Clarion time value. > > If the time elapsed is 1 hour or greater the deformat works else not. > > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > > displays as 00:09 > > What am I doing wrong? > > Thanks! > > Greg Berthume > > Berthume Software > > www.berthume.com | www.cptracker.net > > cpTracker - Contact Management | Project Management | Bug Tracking | Email > > Tools | Sales Tracking
|
Mon, 07 Nov 2005 03:49:32 GMT |
|
 |
Maarte #11 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Greg, Quote: > The problem is that gTimeBetween() is returing 0:00 and not 00:00 and > therefore the conversion to Clarion time value is coming out incorrect.
So the solution should be: Quote: > lTimeSpent=LEFT(gsTimeBetween(CPL:Time,CPL:EndTime))
-- Best regards, Maarten CDD3.1, C5EEb - ABC & C5.5.08EE Certainly Clarion Developer "I know what I know but I do not know what you don't know"
|
Mon, 07 Nov 2005 04:09:32 GMT |
|
 |
Randy Goodhe #12 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Suggestion: You don't need the INT() function when performing integer math. Besides, INT() returns a REAL or a DECIMAL, not a LONG. You are causing the compiler to do extra type conversions. Example: ET# = INT(ET# / 100) ! Can ET# be anything but an integer? ET# = ET# / 100 ! Same results, less code ET# /= 100 ! A little shorthand Quote:
> Greg, this code is not for Gcal, but I use it to calculate travel time, and > on job time in a service dispatching program. It works perfect. > ! calculate ElapsedTIme > ! Elapsed time in 1/100ths of seconds > IF GLO:CUST > 0 > ET# = (CLOCK() - CAL:Arrived) +1 > ET# = INT(ET# / 100) ! Whole seconds now... > Hours# = INT(ET# / 3600) ! Extract any hours > ET# -= Hours# * 3600 ! Reduce to just minutes/seconds > Minutes# = INT(ET# / 60) ! Extract any minutes > ET# -= Minutes# * 60 ! Just seconds remain in ET# now... > IF CAL:Arrived = '' > SiteTime = '00:00:00' > ELSE
> END !IF Cal:Arrived > ! calculate ElapsedTIme > ! Elapsed time in 1/100ths of seconds > IF CAL:Arrived = '' > ET# = (CLOCK() - CAL:AsignedCall) +1 > ELSE > ET# = (CAL:Arrived - CAL:AsignedCall) +1 > END > ET# = INT(ET# / 100) ! Whole seconds now... > Hours# = INT(ET# / 3600) ! Extract any hours > ET# -= Hours# * 3600 ! Reduce to just minutes/seconds > Minutes# = INT(ET# / 60) ! Extract any minutes > ET# -= Minutes# * 60 ! Just seconds remain in ET# now... > !IF CAL:Arrived = '' > !ElapsedTime = '00:00:00' > !ELSE
> ELSE > SiteTime = '00:00:00' > ElapsedTime = '00:00:00' > END > !END !IF CAL:Arrived > HTH > Faron Dunn
> > lTimeSpent=gsTimeBetween(CPL:Time,CPL:EndTime) ! lTimeSpent is a > > STRING(5)
> > gsTimeBetween returns the time elapsed as HH:MM in a string. > > I'm trying to deformat the string into a Clarion time value. > > If the time elapsed is 1 hour or greater the deformat works else not. > > For example, 00:29 returns a Clarion value of 54001 and the time elapsed > > displays as 00:09 > > What am I doing wrong? > > Thanks! > > Greg Berthume > > Berthume Software > > www.berthume.com | www.cptracker.net > > cpTracker - Contact Management | Project Management | Bug Tracking | Email > > Tools | Sales Tracking
-- Randy Goodhew ---[ eQ ]---
|
Mon, 07 Nov 2005 04:23:49 GMT |
|
 |
Maarte #13 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Quote: > > The problem is that gTimeBetween() is returing 0:00 and not 00:00 and > > therefore the conversion to Clarion time value is coming out incorrect. > So the solution should be: > > lTimeSpent=LEFT(gsTimeBetween(CPL:Time,CPL:EndTime))
or IF lTimeSpent[1] = ' ' lTimeSpent[1] = '0' END
-- Best regards, Maarten CDD3.1, C5EEb - ABC & C5.5.08EE Certainly Clarion Developer "I know what I know but I do not know what you don't know"
|
Mon, 07 Nov 2005 04:59:36 GMT |
|
 |
Greg Berthum #14 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
I have it working now. Just needed to discover that the format needed to be 00:00 for the deformat to work. A bug for Jesus to fix. Thanks for all the input! Greg Berthume Berthume Software www.berthume.com | www.cptracker.net cpTracker - Contact Management | Project Management | Bug Tracking | Email Tools | Sales Tracking
Quote: > Greg, > > The problem is that gTimeBetween() is returing 0:00 and not 00:00 and > > therefore the conversion to Clarion time value is coming out incorrect. > So the solution should be: > > lTimeSpent=LEFT(gsTimeBetween(CPL:Time,CPL:EndTime))
> -- > Best regards, > Maarten > CDD3.1, C5EEb - ABC & C5.5.08EE > Certainly Clarion Developer > "I know what I know but I do not know what you don't know"
|
Mon, 07 Nov 2005 05:18:35 GMT |
|
 |
Tony Yor #15 / 16
|
 DEFORMAT(lTimeSpent,@T1) Problem
Hi Greg, You could look at our fsdates class that has a time expired function that returns multi formated strings - go to http://www.fiscal.com.au/clarion.htm - it is simple to add and you can fiddle with the code anytime as it all comes with the package - has an example app and it's Free. Regards Tony Quote:
> I have it working now. Just needed to discover that the format needed to be > 00:00 for the deformat to work. A bug for Jesus to fix. > Thanks for all the input! > Greg Berthume > Berthume Software > www.berthume.com | www.cptracker.net > cpTracker - Contact Management | Project Management | Bug Tracking | Email > Tools | Sales Tracking
> > Greg, > > > The problem is that gTimeBetween() is returing 0:00 and not 00:00 and > > > therefore the conversion to Clarion time value is coming out incorrect. > > So the solution should be: > > > lTimeSpent=LEFT(gsTimeBetween(CPL:Time,CPL:EndTime))
> > -- > > Best regards, > > Maarten > > CDD3.1, C5EEb - ABC & C5.5.08EE > > Certainly Clarion Developer > > "I know what I know but I do not know what you don't know"
|
Mon, 07 Nov 2005 06:19:51 GMT |
|
|