Re: Identify time slots used to perform a piece of work
I've never seen code like this, but its a slow week at work and it seemed like an interesting problem, so I made some. Attached is a database with a module to calculate how much of a work span falls within a time slot. Open the query and it shows the example you provided along with one of mine that I used to test various cases.
Few notes:
--You didn't provide table names, so I used my own.
--I don't like your field names, so I used my own.
--You used reserved words for a few field names (Name & End). You shouldn't do that. Field names need to be less than generic than that--prefix them with what they are the Start and End of and what they are the name of.
--You shouldn't store calculated fields, that means SLOT_MINS shouldn't be a field in your table. You can deduce that by other data already in that record.
--In my example a day starts at 00:00 and ends at 23:59. You had a day ending at 00:00, so that would account for any small differences.
--Your SLOT_MINS is incorrect in your example for Name=Day. There are 719 minutes in that time slot, not 599.
Let me know if you find any issues with my query or want any explanations of how I did it. I noted the function so you should be able to walk yourself through what its doing.
|