View Full Version : Bookings Database


Paul Kendall
03-18-2005, 11:28 AM
Can anyone help.

My Brother has a small Hotel and he has asked if I can build him a Bookings applications.

I can build basic databases, but being not much more than a novice I'm struggling with the concept of some sort of calendar/date database for rented rooms.

Has anyone got an example of a bookings database that I could look at, so I can work out what I need to do.

I have searched but cannot find any help or examples.


Cheryl Lemire
03-18-2005, 12:54 PM

I have not yet had the opportunity to work on a bookings db as you are describing, however maybe I can offer some suggestions to perhaps get you started.

Whenever I take on a new project, it is usually of the type that I have never worked on previously. What I do is take a look at the 'big picture' and work my way backwards.

Find out from your brother what types of reports he wants to be able to get as a result of the db. What type of information will he need on the reports? Will he have room numbers, names of the people staying in the rooms, credit card information, details of the person in the room, price of the room, price changes based on dates, how many staying in the room, arrival date, departure date, etc?

Now take this information, disect it, work backwards and determine what tables you will need to achieve the end results desired.

You will probably want a table to store general room information. The room number, price of room, dates booked, dates available. If prices change based on dates (in season or out of season) you will want a table to track that. You will probably want a scheduling table. You could include the room number, arrival date, departure date. These are just ideas, nothing is concrete.

Hopefully this will get the wheels turning. I have not really put a lot of thought process into this, so please do NOT take this as gospel.

Good luck

Paul Kendall
03-18-2005, 01:45 PM
Hello Cheryl, thanks for the advice. We have talked about his requirements, which are quite basic really, just normal info very much like you stated in your message.

It’s just that I can’t work out how to view a date for a booking in the future. If for instance someone were to request a booking in three months time, there would have to be some kind of lookup calendar with the rooms available in the period the customer was requesting. This is what I can’t work out how to do and why I wanted to see if anyone had anything similar to this, that I could look at.


Cheryl Lemire
03-18-2005, 02:40 PM

Again just thinking off the top of my head, create a table to be used as a one to many link with the room_table as the parent and your new table as the child.

The child table could have fields like:

Then you could run a query when you are booking a room, if date wanted is between date_arr and (date_dept-1), "sorry that room is not available on 'date_wanted', please try another date", preview report of all room numbers that do not have that date booked.

Your query expression could be difficult to get correct because you are working with date fields, but if you lookup tablecount() in the online help files there are several excellent samples of expressions that might help you.

Good luck

Paul Kendall
03-18-2005, 02:43 PM
Thanks Cheryl, I'll have a go.


Finian Lennon
03-20-2005, 04:46 AM
Do a forum search in the V5 and V4 forums on "reservation" (US-speak) as I'm pretty certain that there has been discussion of this before.


Paul Kendall
03-21-2005, 06:31 AM
Thanks Finian, I'll have a look.

Neil Hucker
03-21-2005, 04:07 PM
As Cheryl mentioned building queries or filters with dates can be kind of tricky. This is mainly because the the filter requires a string for the expression. Which can become confusing when trying to use variables (i.e. the two dates you would be trying to seach between) as these variable names will get interpreted literally.
I'm not sure how complex you would make your database, whether you would use a form with built in buttons and script to query (or filter - same thing) your data or if you would just use the Genie to do this for you, but at some stage you will be required to enter an expression for this.
In the Alpha Five help (I'm on V5) there is a page titled "A procedure for building complex expressions". It doesn't come up in the index and can be hard to find. If you type that exact title into the Search Tab search box, it should be one of the results returned.
In the example they use it is being used to set the filter string for a filter in Xbasic, you should be able to apply the concept to the Expression Builder.
Basically if you have to put an expression inside quotes (i.e. a character string) then when you want to quote an actual string with in this you need to use single quotes.

If you want to use a variable then you single quote it like a string but you have to concatenate the variable outside of the expression so it wont be interpreted literally.
Oh and there are also two ways of doing this, using single quotes or the escape character on double quotes (if you see examples for trees in the help files it use the latter). But the single quote method is much simpler.

I don't know if this makes any sense to you. But when you start trying to build filter expressions and you need to use a variable, that page will stop you banging your head against a wall.

Paul Kendall
03-23-2005, 01:57 AM
Thanks Neil, thanks for the help and the pointers.