Jump to content

Calendar Of Recurring Events


Guest FirefoxRocks
 Share

Recommended Posts

Guest FirefoxRocks

In Google Calendar/Windows Live Calendar, you can add recurring events. I was wondering how they do this. Do they store recurring and nonrecurring events in separate tables? If you change the event, you can either change one instance, all future dates of the event or all dates (past and future). How do they do this?

Link to comment
Share on other sites

Guest FirefoxRocks
There's not just one way to do that. How would you do it?
Well to address the first issue, there would be 2 options that I would consider:1. Create columns `recurring` (boolean or tinyint), `recurStart` (date), `recurEnd` (date), `recurPattern` (int). Set `recurring` to TRUE or 1, store the start dates and end dates in the respective columns, set the `recurPattern` value to the milliseconds of recurrence (86400 for daily events, etc.)2. Create a table to specify recurrence: `eventId`, `recurStart` (date), `recurEnd` (date), `recurPattern` (int). This could be faster if you have a huge table I guess.As for the second problem, I think you'll have to copy database values but I'm not really sure because that doesn't make too much sense if it still knows the original start date.
Link to comment
Share on other sites

There might be a few more options to consider, if you use the Windows task manager as an example you can see that you can schedule things to happen each day, or each hour, or every Tuesday, or Monday, Wednesday, Friday, or the 10th day of the month. So if you want to do that the table to store the information is going to need a few more fields to hold all of the options. If I was going to set up something where they could modify recurring events, on the backend I would have it duplicate the event with the changes. So each event has an ID, so a recurring event has a certain ID. There would need to be a field on regular events which maps it to a certain recurring event, so if you have a certain event you could know whether or not it's an instance of a certain recurring event. So if they wanted to make changes to all events, that one would be easy, you just update the recurring event with the changes. If they want to edit a single instance, you would add a new (non-recurring) event, link it up to the recurring event ID so that the system knows to use that instance instead of a recurring instance, and make the changes. If they want to edit all future events, I would change the original event to expire today, and start a new event that starts today with the new data.

Link to comment
Share on other sites

Guest FirefoxRocks
There might be a few more options to consider, if you use the Windows task manager as an example you can see that you can schedule things to happen each day, or each hour, or every Tuesday, or Monday, Wednesday, Friday, or the 10th day of the month. So if you want to do that the table to store the information is going to need a few more fields to hold all of the options. If I was going to set up something where they could modify recurring events, on the backend I would have it duplicate the event with the changes. So each event has an ID, so a recurring event has a certain ID. There would need to be a field on regular events which maps it to a certain recurring event, so if you have a certain event you could know whether or not it's an instance of a certain recurring event. So if they wanted to make changes to all events, that one would be easy, you just update the recurring event with the changes. If they want to edit a single instance, you would add a new (non-recurring) event, link it up to the recurring event ID so that the system knows to use that instance instead of a recurring instance, and make the changes. If they want to edit all future events, I would change the original event to expire today, and start a new event that starts today with the new data.
Ok the part about changing recurring events makes more sense to me now. But how would I store the recurrence of every Tuesday/10th of each month/every third Sunday, etc? And where did you find this in Windows Task Manager (I looked in Windows XP and Windows 7 and I don't see it :S)
Link to comment
Share on other sites

I think justsomeguy meant the Scheduled Tasks manager. It should be available somewhere from the Control Panel.

Link to comment
Share on other sites

Guest FirefoxRocks

Wait so does this mean that for every recurring event, add each instance of the event to the event table and 1 recurring event to the recurring event table so that the application knows exactly when each event is?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...