Well, if you check for the time-span between the TIME IN 09/10/13 and TIME OUT 09/11/13 and if it's too big, open a dialog to let the user enter a date and time when he actually left "logged out" manually (he might have being there over midnight so just checking for day-change will not work).
If the user is still logged in, the check need to be done when the user starts to do something again and the time-span from last to now is of a specified time (ie above 12h or so).
I would have a field for each TIME IN - TIME OUT that could hold a value (ie "Manual entry") if the user added someting manually.
After checking probability of the users entries save that to the TIME OUT and add a new record of TIME IN as well with actuall time.
There is other ways too, but thats a simple one.
Thanks for the quick replied CekariYH. Anyway, we dont have keyboard to use for manual entry because we are using barcode scanner. Can we make a code that tell the system that if NO TIME END this day ( or let's say up to 12 AM) then set field to TIME Start for the next login?
below is the screenshot of the result.
Hmmm, I have no idea how the scanner puts in values into FMP, but you could make a check for last entry every time and if the last entry is a TIME OUT check it against the corresponding TIME IN for a new day or lets say 12h time-span, and if true mark a third field with a "?" and copy the last TIME OUT to a global-tempvariable ($$TempTIME) and add a new record and copy the tempvariable to the TIME IN field and commit (Save).
You also have to deal with if the time of day is normal or not for check-in so it's not making a new check-in if the actual check-out time is true but long.
Not that easy if the time for the persons vary much during a day for example shift-work or called in overtime etc. One have to take that in the math as well depending on... so to say...
Seems like You'll need some means of providing additional input to tell FileMaker what to do. Perhaps with a special Barcode that FileMaker can detect as telling it to do what you want here.
(Unless you are using an iOS device, Barcode readers usually function in keyboard emulation mode--the computer thinks the scanned data was typed in you can even use a scanner to trip script triggers such as OnObjectModify, ONLayoutKeystroke or OnObjectExit.)
After go to record[last]....
If [accessLog::Date ≠ Get ( CurrentDate ) // date in log is for a different day than today's date, person failed to log out the previous day ]
Yes, as Phil suggested.
If true then 1st put in a remark in a remark (or in TimeOut) fileld that TimeOut is missing, then add a new record and put the value in TimeIn?
Thanks guys but it doesn't work here, why?
That wasn't what I had in mind.
With your current script, if the dates match, your script does nothing. If the dates do not match, you need to handle this as an error and do what you need to handle the case when a person has failed to log out the previous day.
Then you insert an Else and the rest of your code can kick in for when the person correctly logged out the previous day.
And the test in the IF step really should be:
If [ accessLog::Date ≠ Get ( CurrentDate ) and IsEmpty ( AccessLog::TimeEnd ) ]
#Do what is appropriate for when the user failed to log out the previous day.
#Current code goes here.
Thanks Phil, good idea and was able to figure out my errors..Great..