Navigation bar
  Print document Start Previous page
 50 of 65 
Next page End  

Gravitybox WebSchedule.NET
1998-2005 Gravitybox Software LLC
Page 48 of 65
you wish. The defined ones map to specific appointment properties link start_date,
length, etc. However if you add a non-standard field like “person_id” to the Appointment
table, the schedule component does not recognize it, so it is placed in the
PropertyItemCollection. In other words all non-standard fields in the Appointment table
are created as a name/value pairs and placed in the PropertyItemCollection of the
associated appointment. If you set the value of one of these objects, it will be persisted
back to the database with no developer interaction! You do not need to write any code
to get database persistence functionality of custom database fields. This is built-in.
The following code assumes that you have a field in your Appointment table named
“person_id”. It is pulled off of the appointment and put in a string variable.
    'Get the first appointment in the collection
    Dim appointment As Appointment
    appointment = Schedule1.AppointmentCollection(0)
    'Get the property value and store it for later
    Dim personId As String = ""
    personId = appointment.PropertyItemCollection("person_id").Setting()
This functionality does not only apply to appointments. Any extra fields added to the
Provider, Category, or Room table triggers the same functionality. The extra fields are
added to the PropertyItemCollection of the respective provider, category, or room
objects.
Non-Standard Datasets
When developing an application that needs to interface with an existing database, you
will most likely want to use your existing database format. As described above the
schedule expects a very specific dataset format. Unless your database model has the
Appointment, Room etc tables defined with the appropriate field names, the schedule
will not bind to it. For many developers this is unacceptable. Fortunately, the schedule
has a built-in way to address this problem. The DataBindings object lets you define the
datatable for each bindable collection and each field of datatable.
In the example below I assume that you have a table name “Engagement” instead of
the standard “Appointment” table. I will also map the field names in the “Engagement”
table to the appropriate fields that the schedule expects.
“Appointment” Table Field
“Engagement” Table Field
Appointment_Guid
Key
Start_Date
Starting
Length
Duration
Subject
Text
The code below assumes that you have loaded a dataset named “MyDataset” with the
“Engagement” table from your database.
http://www.purepage.com