473,545 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parsing of Dates

yk
I am setting up a simple hotel reservation application which have two dates,
i.e. CheckIn and CheckOut. I would like to construct a graph based on a
crosstab query. Therefore, I need to have columns for each date between
CheckIn and CheckOut and the numeric 1 in the field. I have tried but not
successfull. Anyone can help me out? TQ.
Apr 3 '06 #1
1 2023
"yk" <oy*****@gmail. com> schreef in bericht
news:44******** **@news.tm.net. my...
I am setting up a simple hotel reservation application which have two
dates, i.e. CheckIn and CheckOut. I would like to construct a graph based
on a crosstab query. Therefore, I need to have columns for each date
between CheckIn and CheckOut and the numeric 1 in the field. I have tried
but not successfull. Anyone can help me out? TQ.


Tricky, but possible. I did the same in a reservations-database for a
campsite generating a report to show bookings in a certain month (days
horizontal, fields vertical, bookings as the value) and to show all bookings
(fields horizontal and dates vertical continuing on the next pages)

First: create a table / query with all possible dates you would like in your
output. This is possible by creating a table with numbers from 1 to the
largest possible booking-length you can imagine (+ some extra). Call this
"Days".

Let's assume you have a maximum stay of 5 days, so table Days contains five
rows with values 1, 2, 3, 4 and 5.
Let's further assume you have 1 booking with BookingID = 10, CheckIn =
4-3-2006 and Checkout = 6-3-2006

Second: After that, query your table with reservations and 'days' WITHOUT
joining them. This trick is important.
Query both tables without join would result in all possible combinations,
output fields [BookingID] and [CheckIn]+[Day] results in:
10, 4-3-2006
10, 5-3-2006
10, 6-3-2006
10, 7-3-2006
10, 8-3-2006

Add a criterium om column [CheckIn] + [Day] <= [CheckOut]

This results in
10, 4-3-2006
10, 5-3-2006
10, 6-3-2006

Third: continue to do whatever you want. For instance: query the above
result in combination with RoomNumber by joining this with [Bookings] on
[BookingID] = [BookingID]. Make this your cross-tab query with the room
numbers as column headers and the dates as row headers. Show
Count(BookingID ) as the value, and if you see a value larger than 2, you'd
have found a doubly-booked room. Or join this with the table Customers and
show first([Firstname] & " " & [LastName]) as the value to get a cross tab
overview of all customers for each room and for each date.

Experiment with left-joins to get all rooms included, thus also showing the
rooms that are vacant.

Continue to make it fancy with the cross-tab report wizard and work the code
to show occupied rooms in yellow background. Endless possibilities.

Bas Hartkamp.


Apr 5 '06 #2

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

Similar topics

8
9428
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
1
1483
by: Daniel M. Drucker | last post by:
Is there any way to parse tar-style dates like "tomorrow" or "next wednesday" in python, other than doing a system call to date --date="string" and then parsing its output? Daniel Drucker ddrucker@gmail.com
9
2748
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed into a datetime python-object. Does anybody have any pointers on this? Besides the actual parsing, my main concern is the different locale date...
6
4311
by: Tim N. van der Leeuw | last post by:
Hi, I want to parse strings containing date-time, which look like the following: "Mon Dec 19 11:06:12:333 CET 2005" That's a problem for strptime it seems, b/c I cannot find any format-spec for the milliseconds-part in here. (I'm also not sure about the validity of the tz part, but ...)
0
1130
by: Uncle Leo | last post by:
I created an OleDbDataAdapter with the wizard in Visual Studio 2003. It created a dataset, connectionstring etc. for me to work with. It also created a .xsd file where one of the columns type is set to date. My program is being used in many different countries, and many different local settings. Some time ago a user from Turkey contacted me...
5
2325
by: moddster | last post by:
Hi Guys. I am a newbie to perl and need some help with a problem. PROBLEM: I have to parse an HTML file and get rid of all the HTML tags and count the number of sumbissions a person has through out the dates found. The condition is that multiple submissions by the same person on the same date is counted as 1. I have already gotten rid of the...
6
4414
by: rellaboyina | last post by:
Dear All, I am having some data which will be stored in XML format and this needs to be parsed using the parser module XML::Parser and XML::Parser::Expat. This data consists of some special characters like "ø, á, í, é, È, ž, ù, ý". But when I try to parse the particular record with these special characters using the method parse(), I...
1
2323
by: Malcolm Greene | last post by:
The locale module provides the ability to format dates, currency and numbers according to a specific locale. Is there a corresponding module for parsing locale's output to convert locale formatted dates, currency, and numbers back to their native data types on the basis of a specified locale? In other words, a module that will reverse the...
0
1174
by: taa | last post by:
Hi there I’m trying to come up with a smart way of parsing content from textboxes in C#. I have about 7-10 boxes with different content; dates, times, numbers and text that has to be parsed and inserted into my database. Of course the obvious solution is to make a lot of if’s and parse each box one at the time with the properties I know and...
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6022
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.