Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issue: Empty dates and computation
Message
De
02/01/2005 05:19:31
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Issue: Empty dates and computation
Divers
Thread ID:
00973689
Message ID:
00973689
Vues:
51
I want a new set on VFP10
SET SETUNKNOWNRESULTTONULL OFF | ON
Empty concept it is an obsolete concept that arrives from the origins of XBase.
VFPT has the courage to abandon it?

A example:
CLEAR
d1 = DATE()
d2 =DATE(2005,2,31) && return a empty date because the date don't exists
? d1#d2,d1-d2 && are not equal, but difference is zero !! ( empty date go to a empty number )
* workaround, map empty to NULL
d2 =EVL(DATE(2005,2,31),CAST(NULL AS D))
? d1#d2,d1-d2

* effect of empty on computation
dRef = {^2005/1/1}
CREATE CURSOR TESTDATE (DD D NULL)
INSERT INTO TESTDATE VALUES (DATE(2005,2,31)) && this is a unknown date
INSERT INTO TESTDATE VALUES (dRef+1)

SELECT AVG(DD-m.dRef) AvgDiff FROM TESTDATE && Average it is mistaken
USE
ZAP IN TESTDATE
* WORKAROUND
INSERT INTO TESTDATE VALUES (EVL(DATE(2005,2,31),NULL))
INSERT INTO TESTDATE VALUES (dRef+1)

SELECT AVG(DD-m.dRef) AvgDiff FROM TESTDATE
Fabio
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform