Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Comparing to NULL
Message
De
23/07/2007 19:41:04
 
 
À
23/07/2007 19:29:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01243011
Message ID:
01243035
Vues:
31
>>>>
>>>>Then wouldn't just a simple IF (VARTYPE(OLDVAL(FIELD(i))<>VARTYPE(EVALUATE(FIELD(i))) be sufficient, or do you need to know when character (or other type) value changes, too?
>>>
>>>No, this would not work for me. The comparison should work on many different fields. Some fields will change the value but the type will be still be the same. The above expression will not pick up those cases.
>>
>>If a change in type is detected, that can only be to/from "X" (.NULL.). You could have a secondary check if you need to also know the value has changed (while it remains the same type).
>
>I see. But the following also works (unless you see something I am missing):
>
>
>IF (!ISNULL(EVALUATE(FIELD(i))) AND ISNULL(OLDVAL(FIELD
>(i), "V_V_MYTABLE"))) OR ;
>(ISNULL(EVALUATE(FIELD(i))) AND !ISNULL(OLDVAL(FIELD
>(i), "V_V_MYTABLE"))) OR ;
>!(EVALUATE(FIELD(i)) == OLDVAL(FIELD(i), "V_V_MYTABLE"))
>
>
>Thank you.

See other message:

could be written as:
IF (VARTYPE(OLDVAL(FIELD(i))<>VARTYPE(EVALUATE(FIELD(i)))
  *
  * To/From .NULL.
  *
ELSE
  *
  * Type stays the same
  *
  IF ISNULL(EVALUATE(FIELD(i))) OR (OLDVAL(EVALUATE(FIELD(i))==EVALUATE(FIELD(i)))
    *
    * same values
    *
  ELSE
    *
    * different values
    *
  ENDIF
ENDIF
or

IF (VARTYPE(OLDVAL(FIELD(i))<>VARTYPE(EVALUATE(FIELD(i))) OR (ISNULL(EVALUATE(FIELD(i))) OR (OLDVAL(EVALUATE(FIELD(i))==EVALUATE(FIELD(i))))
*
* To/From .NULL. or change in value
*
ELSE
*
* No change
*
ENDIF
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform