Thanks a lot !
I try it and it is very good !
Maybe it is not the best solution, but I call a function() in my Select for rhe fields that I use the "iif" command.
Example :
(before)
Select field1,iif(field2=0,0,field3/field2) as nDiv from myTable
(after)
Select field1,MyFunction("iif(field2=0,0,field3/field2)") as nDiv from myTable
function MyFunction()
lParameters tcCalcul
return evaluate(tcCalcul)
Thanks David !
Your help was very appreciated ! :)
Stef
>>I understand that it not fires with the wait waindow and it is o.k.
>>
>>But, what I don't understand it's WHY it is execute in the SELECT ?
>>
>>It's not supposed to be execute !
>
>It must have something to do with the order of execution, and Fox is calling the test() function to get the expression ready in case it is needed -- probably once when it first parses the SELECT statement, and once when it executes it for your 1 record.
>
>A better approach would probably be to call a function with the cValue as a parameter, and let the function handle the logic and return whatever is needed:
SELECT myfunc(cValue) AS textvalue...
Just be sure to pad the result to the desired length before returning the value.