Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Birthdays this week
Message
 
 
À
19/03/2009 22:20:26
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01389309
Message ID:
01389861
Vues:
42
>>>>>The date() function in your example would fail fail if a person happened to be born on Feb. 29 - I believe that I'll have to convert those dates to Feb. 28, using an iif().
>>>>
>>>>People born on Feb. 29 have birthday every 4 years :)
>>>
>>>Don't they spread it so they take six hours of it on other years - six hours should be enough to have a party, eh?
>>
>>Do you see why the program only works when there is no span between years?
>>
>>PRIVATE test
>>ldStart = DATE(2008,12,31)
>>ldEnd = DATE()
>>
>>SYS(3054,12,'test')
>>
>>lnMonth1 = month(ldStart)
>>lnDay1 = day(ldStart)
>>
>>lnDiff = ldEnd - ldStart
>>
>>select dDOB from Patients where dDOB is not null and dDOB <> {} and dDOB ;
>>between date(year(dDOB),lnMonth1,lnDay1) and (date(year(dDOB),lnMonth1,lnDay1) + lnDiff) ;
>>ORDER BY dDOB INTO CURSOR curTest nofilter
>>
>>BROWSE FOR MONTH(dDob) = 2
>>
>>_cliptext = test
>
>Yes, because for anyone born on 1944-1-2 it will try to find that date between 1944-12-31 and today, which is an interval which starts about 258 days later.

Yes, I think I understood myself this as well.

We need to write conditional code, unfortunately.

If no span, use my code as is

If there is a span, use
select dDOB from Patients where dDOB is not null and dDOB <> {} and (dDOB ;
between date(year(dDOB),lnMonth1,lnDay1) and (date(year(dDOB),12,31)  OR dDOB between(date(year(DOB),1,1) and date(year(DOB),lnMonth2, lnDay2));
ORDER BY dDOB INTO CURSOR curTest nofilter
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform