« Return to Thread: Scheduling: Comparing every appointment to every other appointment time efficiently

Re: Scheduling: Comparing every appointment to every other appointment time efficiently

by David Adams-4 :: Rate this Message:

Reply to Author | View in Thread

On Fri, Nov 13, 2009 at 5:23 AM, Broderick, Sean - Direct Brands
<Sean.Broderick@...> wrote:
> David Adams:
>
> "Now I'm sorting out how to exhaustively compare all appointments in a
> selection for overlaps."
>
> I am confused by this, because the queries discussed before were proposed to
> avoid vector comparisons in a loop construct.

I ended up going with indexed queries on date+time signatures as it's
easy. I'm still interested in a more purely mathematical approach - if
it can be made to run easily in 4D. I mean, calendars are, in one way,
the most commonly used Cartesian space in day-to-day life.

> Thus, when dealing with a subset of records, why not simply use QUERY
> SELECTION?

The earliest query was to answer the question "I want to make an
appointment from 4:00-4:30 in Conference Room A, does that conflict
with any other meetings in that room?" The nested loops are meant to
address the question "I've got 100 appointments with various start/end
times - do any of them overlap?" Yes, QUERY SELECTION would work - but
you would end up with something like this:

CREATE SET([Event];"EventsToCheck")

for ($index;1;records in set("EventsToCheck")
   use set("EventsToCheck")
   goto selected record([Event];$index)
   QUERY SELECTION([event];time range check;*)
   QUERY SELECTION[event];&;skip matching current record)

   do something with the found conflict records, if any.
end for

...you could load IDs into an array instead of using USE SET. If I've
understood correctly, it seems like this approach would end up having
me run the full query for every event.
**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html
   

4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

 « Return to Thread: Scheduling: Comparing every appointment to every other appointment time efficiently