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
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.