473,382 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Overlapping dates logic

Jim
Maybe I am making this too difficult; but I have the following issue:

A record contains a price for a specific Start Date and End Date. If
the user adds a new price, I need to make sure the Start Date doesn't
overlap something that already exists. Meaning the new Start Date
should not overlap the existing Start Date and End Date. Since I am
new to VS2005 I thought perhaps there was a function to look at these
dates... Your input is greatly appreciated!
May 25 '07 #1
4 3919
Well let's just assume for a moment that all the existing date ranges for a
specfic price are contiguous and that the end date for a given price cannot
be earlier than the start date for that price.

The business rule will be that the start date for a new price must be later
than the end date for the most price with the latest end date.

The process to do this is simply:

Find the price that has the highest value for end date

Ensure that the new start date is later than the end date for the price
located

There are may ways of finding the the price with the highest value for end
date.

One way would be to sort the price objects by end date descending and then
the one you want is the first one.

If you were using a SQL database then to find the highest value for end
datae you would use a query something like:

select max([end date]) from prices
"Jim" <Jim@hot_mail.comwrote in message
news:0n********************************@4ax.com...
Maybe I am making this too difficult; but I have the following issue:

A record contains a price for a specific Start Date and End Date. If
the user adds a new price, I need to make sure the Start Date doesn't
overlap something that already exists. Meaning the new Start Date
should not overlap the existing Start Date and End Date. Since I am
new to VS2005 I thought perhaps there was a function to look at these
dates... Your input is greatly appreciated!
May 25 '07 #2
jim
It kinda makes sense, and I am using SQL Server 2005 as the backEnd, but do
you have any coding examples, since I am new to VB/VS2005? Specifically,
you mention finding a price that has the highest value for end date. An
example would be greatly appreciated. I'm kinda VB stupid.
"Stephany Young" <noone@localhostwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
Well let's just assume for a moment that all the existing date ranges for
a specfic price are contiguous and that the end date for a given price
cannot be earlier than the start date for that price.

The business rule will be that the start date for a new price must be
later than the end date for the most price with the latest end date.

The process to do this is simply:

Find the price that has the highest value for end date

Ensure that the new start date is later than the end date for the price
located

There are may ways of finding the the price with the highest value for end
date.

One way would be to sort the price objects by end date descending and then
the one you want is the first one.

If you were using a SQL database then to find the highest value for end
datae you would use a query something like:

select max([end date]) from prices
"Jim" <Jim@hot_mail.comwrote in message
news:0n********************************@4ax.com...
>Maybe I am making this too difficult; but I have the following issue:

A record contains a price for a specific Start Date and End Date. If
the user adds a new price, I need to make sure the Start Date doesn't
overlap something that already exists. Meaning the new Start Date
should not overlap the existing Start Date and End Date. Since I am
new to VS2005 I thought perhaps there was a function to look at these
dates... Your input is greatly appreciated!

May 25 '07 #3
select top 1 * from prices order by [end date] desc
"jim" <ji****@msn.comwrote in message
news:9t******************************@giganews.com ...
It kinda makes sense, and I am using SQL Server 2005 as the backEnd, but
do you have any coding examples, since I am new to VB/VS2005?
Specifically, you mention finding a price that has the highest value for
end date. An example would be greatly appreciated. I'm kinda VB stupid.
"Stephany Young" <noone@localhostwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>Well let's just assume for a moment that all the existing date ranges for
a specfic price are contiguous and that the end date for a given price
cannot be earlier than the start date for that price.

The business rule will be that the start date for a new price must be
later than the end date for the most price with the latest end date.

The process to do this is simply:

Find the price that has the highest value for end date

Ensure that the new start date is later than the end date for the price
located

There are may ways of finding the the price with the highest value for
end date.

One way would be to sort the price objects by end date descending and
then the one you want is the first one.

If you were using a SQL database then to find the highest value for end
datae you would use a query something like:

select max([end date]) from prices
"Jim" <Jim@hot_mail.comwrote in message
news:0n********************************@4ax.com.. .
>>Maybe I am making this too difficult; but I have the following issue:

A record contains a price for a specific Start Date and End Date. If
the user adds a new price, I need to make sure the Start Date doesn't
overlap something that already exists. Meaning the new Start Date
should not overlap the existing Start Date and End Date. Since I am
new to VS2005 I thought perhaps there was a function to look at these
dates... Your input is greatly appreciated!

May 25 '07 #4
jim
Thanks Stephany. I'll give it a shot! Not sure what TOP 1 returns, but
I'll figure it out.

"Stephany Young" <noone@localhostwrote in message
news:OG**************@TK2MSFTNGP05.phx.gbl...
select top 1 * from prices order by [end date] desc
"jim" <ji****@msn.comwrote in message
news:9t******************************@giganews.com ...
>It kinda makes sense, and I am using SQL Server 2005 as the backEnd, but
do you have any coding examples, since I am new to VB/VS2005?
Specifically, you mention finding a price that has the highest value for
end date. An example would be greatly appreciated. I'm kinda VB stupid.
"Stephany Young" <noone@localhostwrote in message
news:e0**************@TK2MSFTNGP04.phx.gbl...
>>Well let's just assume for a moment that all the existing date ranges
for a specfic price are contiguous and that the end date for a given
price cannot be earlier than the start date for that price.

The business rule will be that the start date for a new price must be
later than the end date for the most price with the latest end date.

The process to do this is simply:

Find the price that has the highest value for end date

Ensure that the new start date is later than the end date for the price
located

There are may ways of finding the the price with the highest value for
end date.

One way would be to sort the price objects by end date descending and
then the one you want is the first one.

If you were using a SQL database then to find the highest value for end
datae you would use a query something like:

select max([end date]) from prices
"Jim" <Jim@hot_mail.comwrote in message
news:0n********************************@4ax.com. ..
Maybe I am making this too difficult; but I have the following issue:

A record contains a price for a specific Start Date and End Date. If
the user adds a new price, I need to make sure the Start Date doesn't
overlap something that already exists. Meaning the new Start Date
should not overlap the existing Start Date and End Date. Since I am
new to VS2005 I thought perhaps there was a function to look at these
dates... Your input is greatly appreciated!


May 25 '07 #5

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

Similar topics

3
by: Phil Sandler | last post by:
All, I have a table with start and end dates/times in it, and would like to be able to calculate the number of hours represented, accounting for overlapping records. Note that I am looking...
0
by: Chris Q. | last post by:
I am creating a custom control that contains a list view with dates and times. I need to make sure that times do not overlap. I would like the control to determine if the overlap is occuring with the...
7
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19...
5
by: Gernot Frisch | last post by:
Hi, I have a site: http://www.glbasic.com/bugs.htm where 2 divs (class = "outer") overlap in Firefox. In IE it looks good (although the text part has a too large distance from the header...)...
2
by: serge | last post by:
/* Subject: How best to use BETWEEN Begin and End Dates to find out if an employee was/is member of any group for a certain date range? You can copy/paste this whole post in SQL Query Analyzer...
6
by: George1029 | last post by:
I have an Access table listing cabin numbers, arrival dates, and depart dates. I need to select all cabins (and their dates) having either an arrival date or a depart date within a specified week, or...
2
by: monadel | last post by:
I have a problem with checking the overlapping date. Basically I am developing a database using MS Access (VB scripts) and SQL queries. I have 2 tables which are empTable and empLeaveTable. In a...
4
by: cathy25 | last post by:
Hi, I am new to programming in C#. Now, I am struck with a logic. I have a set of date fields (DateTime picker controls) . I need to find out the least date in those date fields. I tried the...
2
by: Durand | last post by:
I got a really annoying problem with datetime graphs. The problem is that with a long range time graph, the text on the x axis keeps overlapping like here:...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.