October 11th, 2000, 06:01 PM
I'm designing a fully-featured web calendar. You've all seen the kind of thing. My problem is this:
I want the user to be able to add a recurring event with no end date. Say, an event that occurs every Friday, forever.
My current best plan for a data model has a single table for the events. The fields include start date and end date and a parent field that holds the event ID of the parent event if it is a series of recurring events.
So when a recurring event is entered, the first event in the series is created with a parent of 0, and it creates as many events as necessary on subsequent dates with the parent field set to the event ID of the first one in the series.
No problems then if you want to create a series with a defined end date, even if it's miles into the future. But how to do it if there's no end date?
So the approach I've explained is very data-intensive but easy on the processing. The alternative would be to create recurring events on the fly rather than store them as separate event records. But this sounds very processing-intensive. So even if the user wants to see February 2100, the recurring events will still be there.
The third, very nasty alternative is just to set an arbitrary limit to the end year. But that sounds very inelegant.
Has anyone ever modelled this or thought about it? What were your conclusions?