Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Weird set filter to date
Message
De
20/11/2003 03:24:24
 
 
À
20/11/2003 02:50:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00851737
Message ID:
00851743
Vues:
9
>i have table dtr with field swipedate as date. then i have this,
>
>
>sdate={^2003/08/01}
>edate={^2003/08/31}
>use dtr
>set filter to between(swipedate,sdate,edate)
>locate
>
>
>even if there are dates in between the sdate and edate, locate results to none.
>
>what could be wrong?

Following code works fine for me:
#DEFINE hdStartDate	{^2003/08/01}
#DEFINE hdEndDate		{^2003/08/31}

CLOSE DATABASES ALL

CREATE CURSOR BetweenTest ;
	(dDate D)

LOCAL ;
	ldDate, ;
	lnIx, ;
	lnFilteredRecordCount

ldDate = hdStartDate

DO WHILE ldDate <= hdEndDate
	INSERT INTO BetweenTest ;
		(dDate) ;
		VALUES ;
			(ldDate)
	
	ldDate = ldDate + 1

ENDDO

SELECT BetweenTest
SET FILTER TO BETWEEN(dDate, hdStartDate, hdEndDate)

LOCATE
?BetweenTest.dDate  && Finds first record 2003.08.01

COUNT ALL TO lnFilteredRecordCount

?lnFilteredRecordCount  && Returns expected value, 31
Is the code you show your actual code? Is it possible the variables sdate and edate are going out of scope? Are you certain your date values are actually between your start and end dates - maybe the date format is different from what you expect?
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform