Hello again Foxperts
With your assistance, I've come to a final resolution on:
>My current challenge is to develop an expression that will assist in selecting or filtering records in a table that has two DateTime fields that describe when a particular condition is happening.
>
>tBegin is a DateTime field
>tEnd is a DateTime field
>Together they describe a period of time
>
>I need to select all records that intersect a given period of time First let's set a range to consider:
STORE {^2003-07-11,15:00} TO tFrom
STORE {^2003-07-14,07:00} TO tTill
IF tBegin < tTill .AND. IIF(ISBLANK(tEnd),tFrom+1,tEnd) > tFrom
ENDIF
SELECT * FROM exceptn ;
WHERE tBegin < tTill .AND. IIF(ISBLANK(tEnd),tFrom+1,tEnd) > tFrom
The IIF(ISBLANK(..)..) was needed for the special situation where an event has a known start time but an unknown duration, and therefore the tEnd field was left blank.
This will be used to prepare a list of out-of-the-ordinary events that are scheduled to occur in a given time period, such as crews working overtime, equipment that is out of service, etc..... Thanks Tracy, Garrett, Sergey, and Jay for the help!
Randy Bosma
VFP - Because life is too short to code in something else...