Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Birthdays this week
Message
 
 
To
19/03/2009 18:05:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01389309
Message ID:
01389850
Views:
53
>>Hi Hilmar,
>>
>>I was thinking of this problem as well and I think my solution could be simplified this way:
>>
>>lnMonth1 = month(ldStart)
>>lnDay1 = day(ldStart)
>>
>>lnMonth2 = month(ldEnd)
>>lnDay2 = day(ldEnd)
>>
>>if year(ldEnd) > year(ldStart)
>>   lnDiff = 1
>>else
>>   lnDiff = 0
>>endif
>>
>>select * from People where DOB is not null and DOB<> {} and DOB ;
>>between date(year(DOB),lnMonth1,lnDay1) and date(year(DOB) + lnDiff, lnMonth2, lnDay2)
>>
>
>YEAR(DOB)?
>And how 1934 can be between 2008 and 2009?
>:-)
>You mean YEAR(ldStart), right?

No, I meant exactly what I wrote.

I just tried it
PRIVATE test
ldStart = DATE() - 7
ldEnd = DATE()
SYS(3054,12,'test')

lnMonth1 = month(ldStart)
lnDay1 = day(ldStart)

lnMonth2 = month(ldEnd)
lnDay2 = day(ldEnd)

if year(ldEnd) > year(ldStart)
   lnDiff = 1
else
   lnDiff = 0
endif

select dDOB from Patients where dDOB is not null and dDOB<> {} and dDOB ;
between date(year(dDOB),lnMonth1,lnDay1) and date(year(dDOB) + lnDiff, lnMonth2, lnDay2) ;
ORDER BY dDOB INTO CURSOR curTest nofilter
Using index tag Ddob to rushmore optimize table patients
Using index tag Ddob to rushmore optimize table patients
Rushmore optimization level for table patients: partial
The result was correct.

It worked very fast.

Unfortunately, for the years span we need to break it into two periods.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform