Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on IIF() in SQL clause
Message
De
16/03/2003 11:47:29
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00766260
Message ID:
00766320
Vues:
27
>It wasn't called for type=2 but was called in the stage where VFP determines the size of the field. Looks like VFP evaluates both expressions in IIF() to get correct size of a field. Here's another test wich demonstartes that.
SELECT *, ;
>		PADR(IIF(1=1, "1", myudf("2",RECNO())),1) ;
>	FROM test
>* z.z
>2 1
>
>As you can see myudf shouldn't be ever executed but it is for record #1. And again I see the same result in VFP7 and 8.

So, as the record for Type=2 was the first in Temp, that explains why it was acting like this. That might also explain why I never faced that situation before as I probably never encountered that specific scenario.

I guess the best approach is to select only the New.Type field as is in the cursor and then apply a SCAN on that cursor to get specific evaluation.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform