General information
Category:
Coding, syntax & commands
>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
IIF() doesn't perform value assignments. In your first example, if the EMPTY() expression evaulates to .T., then the evaluation of the expression vp_dbfname = "" is returned (.T. or .F.). The actual operation of value assignment is not performed. However, in your second example, the lines of code assigning a value to vp_dbfname are actually executed depending on the IF condition.
HTH
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only