Navigation bar
  Print document Start Previous page
 77 of 90 
Next page End  

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 75 of 90
A single appointment may be saved to an XML stream using its “ToXML” method.
Dim s As String = appointment.ToXML()
How do I get the index of an object in its parent collection?
There are times when you may need to know an object’s index in its parent collection.
This information may be obtained from the parent collection itself. This paradigm holds
true for all object collections. A return value of (-1) indicates that the object does not
exist in the collection.
Dim index As Integer = Schedule1.AppointmentCollection.IndexOf(appointment)
How do I query the appointment collection?
The AppointmentCollection has a method “Find” that may be used to return an
AppointmentList. The code snippet below demonstrates two ways to call the method.
The first returns all appointments for Jan 1, 2004. The second example shows how to
find all appointments with a subject set to the value “MySubject”.
Dim al As AppointmentList
al = Schedule1.AppointmentCollection.Find(#1/1/2004#, #1/1/2004#)
al = Schedule1.AppointmentCollection.Find("MySubject")
How do I combine multiple lists to get a single list?
The AppointmentCollection’s method “Find” can be used to return list based on many
different criteria. Quite often you may wish to combine lists in different ways. For
example you may wish to find all appointments between Jan 1, 2004 and Jan 10, 2004.
In addition you may wish to narrow it further by appointments in some room. You could
also go further in depth based on provider or category. This can be done easily by
combining AppointmentList objects. The code snippet below finds all objects in the date
range Jan 1, 2004 through Jan 10, 2004. It also finds appointments in a particular room.
Dim room As Room
room = Schedule1.RoomCollection("Room1")
Dim list1 As AppointmentList
Dim list2 As AppointmentList
list1 = Schedule1.AppointmentCollection.Find(#1/1/2004#, #1/10/2004#)
list2 = Schedule1.AppointmentCollection.Find(room)
Dim listUnion As AppointmentList
Dim listIntersection As AppointmentList
Dim listDifference As AppointmentList
'All appointment in either list
listUnion = list1.Union(list2)
'Only object that are in both lists