If you're concerned about database storage you could do something like:

Table 1 (tblEvents) - contains all event data
        eventID: Identity/PK field for unique id
        ... All other relevant event data except date ...

Table 2 (tblEventDates) - contains 3 columns:
        edID: Identity/PK field for unique id
        eventID: foreign key that ties to the tblEvents entry
        eventDate: Date of the event


Then in your query just tie them together like:

SELECT tblEvents.*,tblEventDates.*
FROM tblEvents,tblEventDates
WHERE tblEvents.eventID=tblEventDates.eventID
ORDER BY eventDate ASC


Personally, I'd rather store a bunch of small text entries in the
tblEventDates table than have to use DateAdd to check every single day
displayed on the calendar.

I would probably have a selector or a defined limit to how far out a
recurring event can go ... A year would probably be adequate. You could
even base how far out the event can recur based on the datepart. If the
user wants to make an annually recurring event then you'd want to NOT
base it on one year, but if they want something that recurrs every M,W,F
then a year should be sufficient. Just warn the user, or let them enter
the value.

There's probably a smarter way to do this with a field in your event
table that flags Boolean for recurring and then another to specify the
frequency, but actually selecting the date without being a load on CF is
the problem. 

Some wise elder will probably chime in here and make us all look bad
with the no sh** answer we all know exists :)


Joshua Miller
Head Programmer / IT Manager
Garrison Enterprises Inc.
www.garrisonenterprises.net
[EMAIL PROTECTED]
(704) 569-9044 ext. 254
 
************************************************************************
*************
Any views expressed in this message are those of the individual sender,
except where the sender states them to be the views of 
Garrison Enterprises Inc.
 
This e-mail is intended only for the individual or entity to which it is
addressed and contains information that is private and confidential. If
you are not the intended recipient you are hereby notified that any
dissemination, distribution or copying is strictly prohibited. If you 
have received this e-mail in error please delete it immediately and
advise us by return e-mail to [EMAIL PROTECTED]
************************************************************************
*************


-----Original Message-----
From: Andrew Golden [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, January 14, 2003 9:28 AM
To: CF-Talk
Subject: RE: How to handle Calendar Scheduling of Recurring Events?


One option insert the record into the database once and allow the user
to select(if needed) an interval for which the event is to repeat. If
they pick one week use a database column titled "interval" or something
similar. You will also need a "repeating" boolean value to tell if the
event repeats perpetually. You can then use DateAdd() to generate the
other entries and add them to your own hand-built query.

The other, as stated before, is to use DateAdd() from the start date and
the number of days specified in an "interval" variable to increment the
date and add records. I would recommend the addition of a cut off date
to stop adding schedule records.

It really depends on which matters more to you: coding simplicity and
lighter database server load vs. greater data storage needs. 

> -----Original Message-----
> > From: Rick Faircloth [mailto:[EMAIL PROTECTED]]
> > Sent: 14 January 2003 14:07
> > To: CF-Talk
> > Subject: How to handle Calendar Scheduling of Recurring Events?
> >
> >
> > Hi, all.
> >
> > I was wondering about the various approaches that have been taken to

> > scheduling recurring events in a calendar?
> >
> > I haven't worked with auto-insertion of recurring events, but now is

> > the time for my calendar creation to become more sophisticated.
> >
> > Should I insert data for "one-time" events in one table and data for

> > "recurring" events in another with the user specifiying daily, 
> > weekly, monthly, quarterly, yearly, etc...and have code that checks 
> > that table and auto-inserts those events when the day/dates are 
> > checked?
> >
> > How would I handle the City Council meeting that is scheduled on 
> > "the 2nd Tuesday of each month."  Would I have the person inputting 
> > the data fill out or check fields for "1st, 2nd, 3rd, etc.", then 
> > "Tuesday, Wednesday, etc.",
> > each "Week, Month, Year" or whatever?  (That could get really
> > complicated...)
> > Just let them handle that kind of insertion manually?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to