I think I may have a solution! I solution I see is to maintain two tables:
-INDIVIDUALROOMBOOKINGS (already exists - has one record per day).
-Events (new table for DayBack - just like your sample table). This is a parent to INDIVIDUALROOMBOOKINGS with one record per group of INDIVIDUALROOMBOOKINGS records.
In events, we change the start date and end date to be unstored calcs finding the min and max on the related records in INDIVIDUALROOMBOOKINGS.
This raises two problems:
1. -DayBack cannot edit the unstored calc
2. -Finds to operate the calendar are working across unstored calcs.
To solve 1, we just rewrite the script so that it creates/edits/deletes the related records in INDIVIDUALROOMBOOKINGS. For changes made outside of DayBack (which we want reflected on the calendar when they occur), we just have the unstored calc which will change and trigger a redraw (I guess - maybe wrong). Actually, this does not really matter as we don’t need a super live calendar like this. It is OK for the user to have to press refresh. Actually, I just did a test and this is the default behaviour of the calendar anyway. So, bit rambling that
I suppose it boils down to this: i) Dayback draws on the unstored calcs when it refreshes ii) When day back writes an edit (for example, a new end date) it writes it to a new date field “newEndDate” which is used by the script to deal with the related records. So, DayBack writes to one field and reads from another. So, question, will this trigger the DayBack redraw of just the affected event?
Problem 2 is easy to solve when you think about it the right way. You don’t want to do a find on the unstored calcs but that is OK, we don’t have to. You do the find in INDIVIDUALROOMBOOKINGS and then do a GTRR on the found set to the Events table (so finding the found set the calendar needs). Drawing the calendar will be slowed by the necessity of doing the unstored calcs but there won’t be that many since we are only dealing with the ones showing on the calendar at the moment.
Does that make sense?
There is one more problem. I need a record in the Events table whenever INDIVIDUALROOMBOOKINGS are created. So, I will have to find everywhere in the database where this occurs which should be manageable.