Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF() Evaluates Differently Than IF?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00044321
Message ID:
00044344
Views:
34
>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

what you are returning from the code on top is the logical value of the expression vp_dbfname = ...

you should write instead :

vp_dbfname = IIF(EMPTY(thisform.ctextbox1.Value),"",thisform.ctextbox1.Value)

hoping this helps

Christian
Christian Desbourse ( Belgium )
Previous
Reply
Map
View

Click here to load this message in the networking platform