![]() ![]() ![]() ![]() Gravitybox Schedule Primer
Page 89
1998-2004 Gravitybox Software LLC
StartTime
This is the Time at which the search should begin.
ItemLength
This is the length of the desired free slot. The desired
appointment length will be used as this parameter.
IgnoreIndexes
This optional parameter specifies indexes in the
ScheduleItems collection to ignore in the search. If no
appointments should be ignored this value should be set to
empty string (optional default). The ignore indexes are
numbers separated by a space, comma, colon, or semicolon.
The method needs to know the position to begin its search. This is defined by the first
three parameters: StartDate, StartRoom, and StartTime. If any one of these parameters
is not applicable, it is simply ignored. For example, in DayOnly mode there is no
concept of Rooms, so no matter the StartRoom parameter value it will be ignored.
The most curious parameter is the last one, IgnoreIndexes. In most cases, this
parameter will not be set. If using Java, or some other language, that does not allow
optional parameters, the parameter may be set it to empty string. This value will allow
for one or more ScheduleItem objects to be ignored in the search. This is useful if
moving an appointment. If moving appointment 57 to the next available position, the
StartDate and StartRoom parameters would be set the appointments StartDate and
Room properties respectively. The StartTime parameter would be set to the
appointments StartTime plus one ScheduleIncrement. One increment is added
because the appointment already lives where it is and the search is looking for the next
slot. In this case the IgnoreIndexes parameter would be set to 57. This action would
ignore this ScheduleItem object when performing the search. Since the search is
seeking the next slot that contains no conflicts, it does not matter if the specified slot
contains this appointment, since it is being moved anyway.
We can create an example schedule with three appointments. All are one hour long.
They start at 8AM, 9AM, and 10:30AM respectively. It is obvious that the next available,
non-conflicting spot for appointment 2 is for 9:30AM. The appointment may be moved
down thirty minutes and no conflict will occur. If a check is performed to find the next
available slot without specifying an IgnoreIndexes parameter, the returned StartTime
will be 11:30AM. This is because the search will look at 10:30AM as conflicting. Indeed,
there is no one-hour slot available, because appointment two lasts from 9:00AM until
10:00AM. This is why the IgnoreIndexes is so important. In this example, it is not
important to consider appointment two. In fact, it is important that this appointment not
be considered in the search criteria, since this inclusion will cause the search to return
erroneous results.
The method returns a CScheduleEl object. This object is NOT part of the
ScheduleItems collection. It is returned with its StartDate, Room, StartTime, and Length
properties set. All other properties of the object are default values. This object is used
because it has all the necessary properties needed to define the next free slot. If there
|