Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Confusion over NULL
Message
 
 
À
13/03/2007 21:02:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01203230
Message ID:
01203233
Vues:
21
Looks like the variable has to be initialized with something different than null to work, e.g.
LOCAL zz as Integer
zz=0
zz = null
=MESSAGEBOX(STR(zz,5))
without zz=0 it gives the error.

Interestingly, that
local zz as Character
zz=null
=messagebox(val(zz)) && Should give an error too according to Help on VAL
works.

By default, all variables are created with logical type, e.g.


=MESSAGEBOX(TYPE('zz')) returns L, that's why STR doesn't work.

>
>zz = .NULL.
>? ISNULL(zz) ---> .T.
>
>? STR(zz,5) ---> Error:  Function argument value, type, or count is invalid
>? STR(.NULL.,5) ---> .NULL.
>
>? zz+"AA" ---> Operator/Operand type mismatch
>? .NULL. + "AA" ---> .NULL.
>
>? NVL(zz+"AA","xxxxxx") ---> Operator/Operand type mismatch
>? NVL(zz,"xxxxxx") ---> "xxxxxx"
>
>USE myTable
>REPLACE c1 WITH .NULL.
>
>? c1 + "AA" ---> .NULL.
>SCATTER MEMVAR
>? m.c1 + "AA" ---> .NULL.
>
>zz=c1
>? zz + "AA" ---> .NULL.
>
>zz = .NULL.
>? zz + "AA" ---> .NULL.
>
>RELEASE zz
>zz = .NULL.
>and all the errors return
>
>
>
>
>Why do variables directly assigned .NULL. not seem to work correctly while fields and SCATTERed variables give the expected results?
>
>Thanks........Rich
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