We have a multi-column diary, one column per staff member, and we want to show overlapable background items indicating staff availability, on top of which appointments may be made. We have the following data model for storing these background diary blocks:
DiaryBlockID
StaffID
DayOfWeek, eg Monday
StartTime, eg 8:30 AM
EndTime, eg 11:30 AM
Caption, eg 'High priority client appointments'
Color, eg Red
What would be the quickest, best way to load these background diary blocks from the database into a TDBPlanner please?
You could store this as records in the database and implement the DBxxxSource.OnFieldsToItem event and in this event set item.Background := true and item.AllowOverlap := true
Thanks. I don't think this will help our situation because the read-only
DiaryBlocks are quite different to the Appointments, which are being
loaded/edited/saved via the TDBDaySource. We want to load the diary
blocks ONCE, as needed, eg when the visible Day changes, with
colors/captions different to the appointment items. Is this possible?
Currently, if I add a diary block in my test code (using
TDBPlanner.CreateItemAtSelection), it is actually inserting an
appointment record, which is not the desired affect.
Also, is it possible to make the background items look less significant
(faded) than the Appointments, and make the Appointments
opaque/see-through?
Do you mean you want to create the background items programmatically instead of loading from the DB?
If so, call Planner.CreateItem and set item.NonDBItem := true.
Wrt background item appearance, there is currently no opacity setting, just the Color/ColorTo can be set.
Thanks. Looks like your suggestion would have worked. We wanted to be able to load our background appointments from the DiaryBlocks DB table, to indicate staff availability, and load the non-background client appointments from the Appointment DB table. Realizing that wasn't possible, we have now modified the Appointment DB table to include a Background boolean field, and load/edit appointments accordingly.