Information générale
Catégorie:
Codage, syntaxe et commandes
Hi,
vp_dbfname = iif(EMPTY(thisform.ctextbox1.Value), "",
thisform.ctextbox1.Value)
Can it be replaced with the following?
vp_dbfName= thisform.ctextbox1.Value
Regards?
Biju
>
>
> Ok, all together now, everyone kick me. Yes, this is what I get for
> staying up too late programming. Heh, after using iif() for all this time
> correctly my mind just decides to try something different for no apparent
> reason. :).
>
> >>Here's an odd one. The following code returns two different answers, even
> though they should be identical:
> >>
> >>****************
> >>* The following code makes vp_dbfname = ""
> >>****************
> >>iif(EMPTY(thisform.ctextbox1.Value),vp_dbfname = "", ;
> >> vp_dbfname = thisform.ctextbox1.Value)
> >>
> >>****************
> >>* This code makes vp_dbfname = thisform.ctextbox1.Value
> >>****************
> >>if EMPTY(thisform.ctextbox1.Value)
> >> vp_dbfname=""
> >>else
> >> vp_dbfname = thisform.ctextbox1.Value
> >>endif
> >
> >Hi Michael!
> >
> >IIF() is something diiferent, than you think it.
> >
> >The sintax of IIF() is:
> >
> >IIF(lExpression, eExpression1, eExpression2)
> >
> >In your example, you don't use expression, instead, you use a statement.
> (assigment) But VFP, in this case thinks, that it is an expression, and it
> evaluates it. VFP tests the equality.
> >And depending on the result, gives .T. or .F., depending on the value of
> vp_dbfname.
> >IIF is a function, which gives back either the value of the first, or the
> value of the second expression.
> >So, you should use:
> >
> >vp_dbfname = iif(EMPTY(thisform.ctextbox1.Value), "",
> thisform.ctextbox1.Value)
> >
> >Good luck!
> >
> >BB
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement