>Can somebody explain the following?
>
>Taking the Tastrade sample:
>Type the following in to the command window:
> SELECT * from supplier WHERE IIF(supplier_id < " 10",.T.,.F.)
>
>You get the records with ID's of 1 to 9
>
>If you add a not to it:
>SELECT * from supplier WHERE !IIF(supplier_id < " 10",.T.,.F.)
>
>I know that the expression "IIF(xxx,.T.,.F.)" is as even more pointless than "IF xxx = .T." but it was actually generated by a querying tool we have written. Of course, I could fix the problem, but I am intrigued since I am pretty sure that I am up against my own ignorance rather than a bug. Any intelligible explanation would be gratefully received!
Chris,
Not only with iif() but happens with similar functions like isnull(). If you force an evaluation than you get correct results.
For fun this returns what you expected :
SELECT * from supplier WHERE eval(IIF(supplier_id < " 10",'.T.','.F.'))
Or :
SELECT * from supplier WHERE IIF(supplier_id < " 10",.T.,.F.) = .t.
Cetin