Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF in a SELECT
Message
From
10/03/2000 00:12:51
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00343773
Message ID:
00344032
Views:
56
This doesn't really explain it. I changed the code a little bit:
create cursor curTest (cValue integer)
 select curTest
 insert into curTest values(2)
 brow

 select iif(cValue=2,test("Yes ")+"it will not execute the function",test("No ")+"it will execute it (select)");
 from curTest

 close table all

 function test(x)
 ?x
* = Messagebox(x + "function test")
 return ""
The output is:
Yes
Yes
Yes
No
No
Yes

So, the last Yes is for the selected record. One other Yes or No is to determine the type/size of the column.
Let's say that VFP will evaluate once (for whatever resons) each expression, so we can "explain" another Yes and No.

Where are the remaining results coming from?

Vlad

>That is not an error. VFP does a test parsing of teh SELECT commadn before it actually runs the command. You are seeing your UDF called for the text and then for the actual processing.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform