View Full Version : Time clock function


03-01-2005, 07:12 PM
I am using Alpha5, full version. I have created a function and called Time Clock. This is how I created it.
Function time_clock as C(in as C,Out as C, Break as C)
dim secs as n
constant FULL_DAY = 24*60*60 ' SECONDS IN A DAY
if toseconds(out)"toseconds(in) then
end if
end function

I sucessfully created the function, and according to the article it said to enter the function into expression builder for the field I have called Total_day. I have entered the function as:
I get a error message saying the expression is invalid or incomplete.
I know that if you use the funcion Totime my timecard punchs will work as long as TIME_OUT is greater than TIME_IN. But if someone times in at 10:00pm and times out 7:00am then you get a negative number which is not right.
What have I done wrong, or is it I don't understand what I am trying to do.

Raymond Lyons
03-01-2005, 08:58 PM
Someone else can probably give you a proper function for what you want. My only comment is, where in the world did:


come from? "Duration" would have to be defined somewhere, wouldn't it? What article did this function come from?


03-02-2005, 02:31 AM
This is where I got it.


03-02-2005, 02:39 AM
I forgotten to mention in my reply that the function is defined at the end of the article a dialog box that says "Show me the function", click on that and it shows how to write the function.

Tom Cone Jr
03-02-2005, 03:12 AM
Looks like a simple bug in the function.





Let us know how it goes.

-- tom

03-02-2005, 08:09 AM
After changing "duration" with "secs" in the time card function, there are no errors. But when I enter the function into the total time calculated field rule it still has no errors.
I open the database and enter new times in the "in" & "out" fields and when I get to the "Total Time" field there is no result.
Now I am wondering if the expression in the "Total Time" is right. "Time_Clock(in,out,Break)
the fields are as follows:
in is C with length 8
out is C with length 8
break is C

Tom Cone Jr
03-02-2005, 08:32 AM
Check the examples in the help files for to_secs() function. Your input arguments must be in the right format.

-- tom

Raymond Lyons
03-02-2005, 02:03 PM

you have an extra "t" in your line ("-totseconds):


Plus Peter Wayne must have left out a line:

duration = secs

Then in you fields, if you enter Start "11:00PM", End "7:00AM" and Break "0:30" you should come out with the correct, non-negative answer.

Ray Lyons

03-02-2005, 04:01 PM
Thanks for your answer. Everybody on this forum is great.