Reid Posted July 3, 2012 Posted July 3, 2012 Hello, I have a table that records the start time and the end time for a job by each employee. I want to automatically have the start time be the end time of the last job completed. Something like: IF (Find all end times for today from a certain employee, choose the most recent end time, set the most recent end time as a $variable, set the current record start time as $variable) Else Allow to set start time field manually
Tim W Posted July 3, 2012 Posted July 3, 2012 Hi Reid, Why not create a record field (brain ahead of fingers again) in the employee table and refer/update it each time a task starts or finishes. You could tie it to a date field which could be set when it is not equal to the current date. The max function or any find would bring a certain degree of overhead since it would have to create a found set and walk the records to get the greatest value. Also, with this way of doing it am/pm would be controlled with less effort. HTH, Tim
Reid Posted July 3, 2012 Author Posted July 3, 2012 Thanks Tim! That sounds like a better approach that what I was taking. I'll give it a try.
Vaughan Posted July 3, 2012 Posted July 3, 2012 A couple of ways. Each employee could have a record in "Employees" table. A calculation in Employees could calculate the last finish date and time for the employee. The could be referenced when making a new Job record. If there is no employees table, instead make a Jobs self-join relationship based on the employee name. Use this self-join to calculate the last finish date and time.
Recommended Posts
This topic is 4529 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now