Gossamer Forum
Home : Products : DBMan : Installation :

DB Design question

Quote Reply
DB Design question
I'm trying to create a community calendar db and I've got the DBMan demo up and running thanks to searching the forum for answers to my questions before I asked but now I've run into something I'm not sure how to handle and I haven't been able to find a topic that really covers the issue.

I'm not sure what the best way to set up date entry is. I want the final view all output to be ordered by date and each to be able to search for events happening on a specific day.

However, many events will be occurring on multiple and non-sequential days. For example Event x is on the 1st, 3-4th, and 20th. I thought about a checkbox that they can click on each day individually but that could get tedious. I also thought about just a plain begin date and end date situation but that wouldn't take care of the dates the event doesn't happen.

Also the same event may not be at the same time on each of those days. Ex. 7-8 on the 1st and 30th and 8-5 on the 3-4th.

Breaking up event x isn't an option. Any suggestions on how I should set this up?
Quote Reply
Re: DB Design question In reply to
This is a toughie!

The only thing I can think of is to have a number of fields where users can input dates and times. How many different ones could there be?

I suppose you would have to set up fields like

Date1
Time1
Date2
Time2
Date3
Time3

(however many you would need)

Given your example, then the user could enter:

Date1: 1 April 2000
Time1: 8pm
Date2: 3 April 2000 - 4 April 2000
Time2: noon
Date3: 20 April 2000
Time3: 8pm

I would have to think about how to do searches on the ranges, too.

Coding-wise, the easiest way to do it would be to have a separate record for each date/time combination. But I don't think your users would like that. Smile

Unless you had them fill out the details for one date and then, on the add_success form, had checkboxes for other dates. When they submitted the form with the checkboxes, multiple records would be generated.

Still doesn't get around the different time, thing, though, does it?

I might have to ponder this one for a while.


------------------
JPD





Quote Reply
Re: DB Design question In reply to
Yeah, your first idea is sort of like mine. I was thinking of an array of check boxes where you just select each date (1 to 31.) That way when you did a search for a particular day it would be a matter of looking to see if there is a value in a field.

I got rid of that idea because an event could begin in one month and end in another. Which would require multiple sets of dates.

Then, of course, there is the time element as well.

I'm now thinking of partially ignoring the time element. Add day, evening, and all day fields (that apply to the event as a whole) to let people search by that and have another field for them to enter the times. (probably a text box) The times wouldn't be searchable but they would get displayed. I think this would be easier than trying to associate the times with the dates. Of course what is easier for me wouldn't necessarily be the best for the user... again, I'm in a pickle here.
Quote Reply
Re: DB Design question In reply to
I've setup a simple calendar of events which might give you some ideas.

I used the short/long display so that all events are listed, and sorted by the starting day of the event. The long display would then contain all the details and provide the additional event dates .. say if it runs for a week or so.

Not sure this is what you want but it may give you some ideas. You can add different fields and set it up to be searched differently.

http://www.lanecountyauction.com/calendar.htm

When I get some time and if there is more interest in using the calendar I may work on making it fancier Smile
Quote Reply
Re: DB Design question In reply to
I very much like what you've done there. It allows for text entry for the various times/days issue I was fretting about.

However, I need it to go a few steps further. If all events were on consecutive days I would definately do something like you've done but not all of the events are set up that way.

I also wanted to have it searchable in a way that lets you know what is going on today or on a particular day. So if an event say runs from the 3rd to the 15th and today is the 10th they could find all events that are currently running regardless of when the event started. I want to do this because there are several events that although they have already started you can still participate until they end. (Ex. A show that runs every weekend.) I'm going to have another field that can be checked to say in effect no drop-ins and those events that don't have a start date in the present or future won't be listed in a search for the current date if they don't support drop-ins.

If I have it set up to enter only the begin and end dates I don't think I'd be able to pull that info. Or maybe I'm missing something. It seems to me one could have a begin date and an end date and search for results using the -lt -gt but that doesn't work across months does it? Ex. List all events between April 20th and May 5th. Also a search for everything happening on April 22nd wouldn't pull up an event that begins on April 20th and ends May 5th. Would it?

I am going to take a longer look at your setup and if you have any more ideas I'd love to hear them.
Quote Reply
Re: DB Design question In reply to
Several issues--

I went to the CGI Resources website and looked at every available calendar program. The options for adding events varied quite a bit.

Several required that the full entry be added to each date. Some of these did allow for repeats every year.

Some had the user enter the information on the first day of the event and then could set how many times it would be repeated and at what intervals -- every day, every week, every month, every month-day, every year. (I'm not sure what the difference between "month" and "month-day" is. Possibly, "the 22nd of every month" or "the third Thursday of every month") One went a little further an allowed entries so the event could be every two weeks, months, years, etc.

Two of them that I saw had calendars with checkboxes to allow for direct entries of dates. One had the full month of whatever month was first selected in a little calendar format. The other had 365 checkboxes, on a full year's calendar. I personally preferred the former one.

With every one, however, there was no option to set different times for the same event on different days. All would require a second entry in order to set a different time.

I did think that this might be possible with a relational database. One .db file would be the full event info. The other would be the date/time info. Users could add the event info on one form, submit it, and then add multiple entries for date and time. Does this sound like a possibility?

The -lt and -gt searches will work across months. The dates are first converted to Unix time and then compared.


------------------
JPD





Quote Reply
Re: DB Design question In reply to
I wrote this offline before reading JPDeni's response. But since I spent all that time putting it together .. I'm going to post it anyway Smile

I think I understand exactly what you are wanting to do Smile I'm just not sure how to do it with DBMan. I was going to try and create something similiar myself, but it has never been a top priority. And I found that using Matt Kruse's calendar script served the purpose for the client.
http://mkruse.netexpress.net/ sample uses: http://ciec07bsa.hypermart.net/

I would hate to discourage you from using DBMan for your calendar but that script is very customizable and will do exacly what you want. You may want to check it out for ideas and examples of the it stores the data for each event.

Using DBMan I don't know how much you know about the script or your ability to put all the mods together, but I think it is possible to do what you want. JPDeni would be better at knowing if it could be done, but you wouldn't want to have her put it all together for you and miss out on the challenge yourself Smile

I know that some of the pieces or current mods that you would want to check out are:

1) The What's New mod may be something to look at for showing what's happening today.

2) Multiple Select Field - to be able to select consecutive days for the event. I think if it's like every weekend, you would need to enter it for each weekend?

3) If they event is going to allow drop-ins - I could be wrong but you may want to name this something other then start date and perhaps make it a radio select box they can choose when they list the event: drop-in yes|no And then say if drop-in = yes display it otherwise don't. That part may be tricky Smile

4) Searching and sorting by dates - JPDeni has written a mod called Universal Date Translator which says it can sorts and looks for "greater than" and "less than" dates, and it says it will allows users to search for parts of dates, such as the year or the month. I've never used this but It sure sounds like it would be something to check out for this application.

For any calendar type program I have seen, it mainly displays the event name and date and then you go to the details for further information. Using the short/long display would allow for showing many events that fall within a certain month and can be sorted by date or whatever.

Check the resource center or http://www.jpdeni.com/ for: What's New and Date Translator mods.

For the Muliple Select fields check: http://www.gossamer-threads.com/scripts/forum/resources/Forum5/HTML/000957.html

I sure hope this will give you some ideas and the mods to help get you going.

----
After reading Carol's response, I think the relational mod would work great as she stated for events that happen say every other weekend. But the question would be if the description going to have to be modified by the user for what's happening for each specific weekend?

The database I used as an example for the boyscout calendar uses a .txt file that stores the data like this just as an example (mind you the descriptions are very short)

106|20000206|Scouting Anniversary Week|Scouting Anniversary Week Begins
113|20000207|Scouting Anniversary
114|20000208|Scouting Anniversary
115|20000209|Scouting Anniversary
107|20000210|District Committee Mtg.<P>
116|20000210|Scouting Anniversary
117|20000211|Scouting Anniversary
118|20000212|Scouting Anniversary
119|20000217|Council Executive Committee Mtg.
120|20000224|OA Lodge Mtg.
108|20000225|Spring Camporee
109|20000226|Spring Camporee
121|20000302|Roundtables - All Unit Leaders<P>
122|20000302|Youth Protection Training<P>
123|20000302|O-A Chapter Meeting<P>
124|20000302|District Commissioner Mtg.<P>
125|20000302|District Committee Mtg.
126|20000303|OA Lodge Mtg.
127|20000303|Klondikes (Cubs)
128|20000304|Klondikes (Cubs)<P>
129|20000304|Aide-De-Camp Orders Due
130|20000311|Spring Tea<P>
131|20000311|Cub Ldr Basic 2000-4<P>|Cub Leader Basic 2000-4 Low Desert
132|20000311|Klondikes (Explorer/Venture)<P>|Klondikes (Explorer/Venture) @ CH
133|20000311|Sctmstrship Fund 2000-1|Scoutmastership Fundamentals 2000-1 @ Council

Hope I'm not just confusing the issue with my response Smile As you can see in this case no user information is stored, only the event information.