Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Consecutive Dates
Message
 
To
16/09/2002 21:22:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00701055
Message ID:
00701061
Views:
16
This could help:
** Set up some test data

CREATE CURSOR Allocated (Emp_ID I, AllocDate D)

INSERT INTO Allocated VALUES (1, DATE() + 1)
INSERT INTO Allocated VALUES (1, DATE() + 2)
INSERT INTO Allocated VALUES (1, DATE() + 3)
INSERT INTO Allocated VALUES (1, DATE() + 6)
INSERT INTO Allocated VALUES (1, DATE() + 7)
INSERT INTO Allocated VALUES (1, DATE() + 9)
INSERT INTO Allocated VALUES (1, DATE() + 10)
INSERT INTO Allocated VALUES (1, DATE() + 11)
INSERT INTO Allocated VALUES (1, DATE() + 16)
INSERT INTO Allocated VALUES (1, DATE() + 17)

INSERT INTO Allocated VALUES (2, DATE() + 1)
INSERT INTO Allocated VALUES (2, DATE() + 2)
INSERT INTO Allocated VALUES (2, DATE() + 4)
INSERT INTO Allocated VALUES (2, DATE() + 5)
INSERT INTO Allocated VALUES (2, DATE() + 7)
INSERT INTO Allocated VALUES (2, DATE() + 9)
INSERT INTO Allocated VALUES (2, DATE() + 10)
INSERT INTO Allocated VALUES (2, DATE() + 12)
INSERT INTO Allocated VALUES (2, DATE() + 13)
INSERT INTO Allocated VALUES (2, DATE() + 14)

* Real program

#DEFINE DAYSAHEAD	21
CREATE CURSOR DaysList (FreeDate D)
LOCAL lnIncr
FOR lnIncr = 0 TO DAYSAHEAD - 1
  INSERT INTO DaysList VALUES (DATE() + lnIncr)
ENDFOR

SELECT FreeDate ;
 FROM DaysList ;
 WHERE FreeDate NOT in (select AllocDate FROM Allocated WHERE Emp_ID = 1)
In addition, Tom Moreau had a much more extensive algorithm in the June 2001 SQL Server Professional. See http://www.pinpub.com/sq/

Cheers,

Andrew
>Does anyone have an idea on how to look at a list of dates and pick up where gaps might be. I have a work scheduling app and I need to show the schedule graphically. So I need to know when a person is scheduled for a couple of weeks this month and then not again until say a week of next January.


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Reply
Map
View

Click here to load this message in the networking platform