> In your method - do you propose making a DB Table of ALL
> Dates - and a Second Table of Dates you Cannot ship on
Yes, calendar tables usually contain ALL dates. How you store the exceptions
depends on the individual application. For example, in one of ours we needed to
generate calendars for different companies. Since each company had a different
set of holidays, we stored the excluded dates in a separate table, by company
id. Then used an outer join between the two tables. If the value from the
secondary table was _not_ null, the date was excluded, otherwise it was a
regular (non-excluded) date.
If you do not need to handle different holidays for different companies, you
could just store that information in the main calendar table as another bit
column, like "IsHoliday" or "IsExcluded". Then just filter on that column in
your queries to exclude those dates as needed.
> But I could certainly make the customer enter them in each
> year...
Yes, you could have a simple admin interface for that purpose.
> So - with that in mind - how could I do it? Without
> storing "future dates"
> - like this?
It depends on which table structure you choose. With the single table
structure, your query could filter on the holiday flag to exclude those dates.
...
WHERE IsHoliday = 0
AND ...
Same concept for the two table structure. Just slightly different sql due to
the outer join. Something like
...
FROM CalendarTable c LEFT JOIN ExcludedDates e ON c.TheDate = e.TheDate
WHERE e.TheDate IS NULL
-Leigh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329776
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4