473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Calendar recurring events logic

I'm having a calendar feature developed whereby users can add recurring
events. These recurring events can have start and end dates, meaning they
will recur only within a date range. For instance, user A creates an event
that recurs every Tuesday, from 1/1/05 - 3/2/06.

The developer has decided that it would be good to have another table that
stores each individual recurring event in a separate record. His logic is
that this will help with the display of calendar months. His logic is, if
the application has to dynamically iterate through every event record in the
database and logically map out which days have recurrence, that it would not
be good for performance.

My take though, is that if one recurring event can literally add in 10,000
records, then that's even worse.

What are your thoughts on the proper way to implement this?

Jul 21 '05 #1
5 3848
Hi
It has always been hard to suggest for design issues,because you and only
you know exactly the business requrements.
CREATE TABLE Req_Events
(
EventId INT NOT NULL PRIMARY KEY,
UserId INT NOT NULL FOREIGN KEY ------Users Table,
StartDate DATETIME NOT NULL,
EndDate DATETIME NOT NULL -----you can create here a check constraints that
enddate must be less than startdate
)

"Shabam" <ch*****@yomama-nospam.com> wrote in message
news:Wf********************@adelphia.com...
I'm having a calendar feature developed whereby users can add recurring
events. These recurring events can have start and end dates, meaning they
will recur only within a date range. For instance, user A creates an event that recurs every Tuesday, from 1/1/05 - 3/2/06.

The developer has decided that it would be good to have another table that
stores each individual recurring event in a separate record. His logic is
that this will help with the display of calendar months. His logic is, if
the application has to dynamically iterate through every event record in the database and logically map out which days have recurrence, that it would not be good for performance.

My take though, is that if one recurring event can literally add in 10,000
records, then that's even worse.

What are your thoughts on the proper way to implement this?

Jul 21 '05 #2
Hi

From my perspective.
Create and entry for each occurrence in the main table, and link all the
occurrences together with an occurrence ID. This will enable the user to
remove a single occurrence (like an event that falls on a public holiday that
nobody would attend), without upsetting any logic. This may sound expensive,
but when you query for a specific user "Give me the events between today and
Sunday", it is a single query to a single table with a between operator. No
complicated logic to find out if there is a recurring event in the pile too.

An occurrence can also be changed. If a meeting moved from tomorrow onwards
to a new time, the old records for events that have occurred in the past
remain, and only the records dated tomorrow and later would be updated with
the new time. History can't change.

An occurrence is just a quick UI way for a user to do something that is
repetitive. It should not be handled in a different manner, compared to a
single event, in a DB just because of this. Separating Presentation and Data
logic.

Regards
Mike

"Shabam" wrote:
I'm having a calendar feature developed whereby users can add recurring
events. These recurring events can have start and end dates, meaning they
will recur only within a date range. For instance, user A creates an event
that recurs every Tuesday, from 1/1/05 - 3/2/06.

The developer has decided that it would be good to have another table that
stores each individual recurring event in a separate record. His logic is
that this will help with the display of calendar months. His logic is, if
the application has to dynamically iterate through every event record in the
database and logically map out which days have recurrence, that it would not
be good for performance.

My take though, is that if one recurring event can literally add in 10,000
records, then that's even worse.

What are your thoughts on the proper way to implement this?

Jul 21 '05 #3
> From my perspective.
Create and entry for each occurrence in the main table, and link all the
occurrences together with an occurrence ID. This will enable the user to
remove a single occurrence (like an event that falls on a public holiday that nobody would attend), without upsetting any logic. This may sound expensive, but when you query for a specific user "Give me the events between today and Sunday", it is a single query to a single table with a between operator. No complicated logic to find out if there is a recurring event in the pile too.
An occurrence can also be changed. If a meeting moved from tomorrow onwards to a new time, the old records for events that have occurred in the past
remain, and only the records dated tomorrow and later would be updated with the new time. History can't change.

An occurrence is just a quick UI way for a user to do something that is
repetitive. It should not be handled in a different manner, compared to a
single event, in a DB just because of this. Separating Presentation and Data logic.


Sounds fine, but what the system will allow many users to set up their own
calendars. If a user sets up an event that literally has 1000 individual
recurrences, then it won't take many users to bloat the database to an
unacceptable level wouldn't it? Also, the thought of a user clicking a
single button that generates 1000 records just doesn't seem right to me.
Jul 21 '05 #4
sp_msforeachdb 'EXEC sp_helpfile'

Note that sp_msforeachdb is not documented, not supported etc. Also, if you don't like the result
structure, you can easily change that by taking the source for from sp_helpfile and write your own
version that presents the information in a way that you like it.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Shabam" <ch*****@yomama-nospam.com> wrote in message news:Wf********************@adelphia.com...
I'm having a calendar feature developed whereby users can add recurring
events. These recurring events can have start and end dates, meaning they
will recur only within a date range. For instance, user A creates an event
that recurs every Tuesday, from 1/1/05 - 3/2/06.

The developer has decided that it would be good to have another table that
stores each individual recurring event in a separate record. His logic is
that this will help with the display of calendar months. His logic is, if
the application has to dynamically iterate through every event record in the
database and logically map out which days have recurrence, that it would not
be good for performance.

My take though, is that if one recurring event can literally add in 10,000
records, then that's even worse.

What are your thoughts on the proper way to implement this?

Jul 21 '05 #5
Oops. Replied to wrong thread. Please ignore.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Tibor Karaszi" <ti***************************@hotmail.nomail.co m> wrote in message
news:e1**************@TK2MSFTNGP09.phx.gbl...
sp_msforeachdb 'EXEC sp_helpfile'

Note that sp_msforeachdb is not documented, not supported etc. Also, if you don't like the result
structure, you can easily change that by taking the source for from sp_helpfile and write your own
version that presents the information in a way that you like it.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Shabam" <ch*****@yomama-nospam.com> wrote in message news:Wf********************@adelphia.com...
I'm having a calendar feature developed whereby users can add recurring
events. These recurring events can have start and end dates, meaning they
will recur only within a date range. For instance, user A creates an event
that recurs every Tuesday, from 1/1/05 - 3/2/06.

The developer has decided that it would be good to have another table that
stores each individual recurring event in a separate record. His logic is
that this will help with the display of calendar months. His logic is, if
the application has to dynamically iterate through every event record in the
database and logically map out which days have recurrence, that it would not
be good for performance.

My take though, is that if one recurring event can literally add in 10,000
records, then that's even worse.

What are your thoughts on the proper way to implement this?


Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Wm | last post by:
I have a client who needs a good web-based calendar for their website. What they would like is something that can display a monthly calendar online, with a display that's large enough that you can...
8
by: Shyguy | last post by:
Is it possible to create a calendar that shows previous input data and also allows for input of new data?
3
by: Chuck Van Den Corput | last post by:
In one of my apps, I developed a calendar report composed of a 6x7 grid of subreports, one for each potential day in a month (the worst case scenario is that a month spans 6 weeks, like July 2005)....
5
by: Shabam | last post by:
I'm having a calendar feature developed whereby users can add recurring events. These recurring events can have start and end dates, meaning they will recur only within a date range. For...
38
by: George Sexton | last post by:
We're in the process of re-launching our web calendar product. We would like to get your opinions on a couple of things about our site and product. This is a relaunch of an existing product with...
0
by: larry | last post by:
I am in the process of rewriting one of my first PHP scripts, an event calendar, and wanted to share the code that is the core of the new calendar. My current/previous calendar processed data...
1
by: ITistic | last post by:
I am in the planning stages of a new web application. One of the requirements for this application is to provide a Google Calendar type interface to show important events which will be pulled from...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.