Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Verification on IIF() in SQL clause
Message
 
 
À
15/03/2003 23:07:47
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:
00766264
Vues:
20
Michel,

How do you know that both conditions where evaluated?

>With VFP 7, I was able to do something like this:
>
>
>SELECT New.Numero,New.Titre AS Title,New.Message AS Summary,;
> IIF(New.Type=2,PADR(New.Url,250),;
>  PADR(GetUrlArticleMagazine(New.Month,New.Year,New.Page,New.Type,New.Url),250) AS Url,;
> New.Creation FROM Temp;
> INNER JOIN New ON Temp.Numero=New.Numero;
> ORDER BY 5 DESCENDING INTO CURSOR Temp
>
>
>where GetURLArticleMagazine() is:
>
>
>FUNCTION GetURLArticleMagazine
>PARAMETERS tnMonth,tnYear,tnPage
>RETURN 'http://www.something...'
>
>
>In VFP 8, I have found that even if the type is 2, that both conditions will be executed. Thus, it causes a problem as it's not suppose to execute both evaluations but only the one as per the type value.
>
>So, I had to adjust it like this:
>
>
>SELECT New.Numero,New.Titre AS Title,New.Message AS Summary,;
> GetUrlArticleMagazine2(New.Month,New.Year,New.Page,New.Type,New.Url) AS Url,;
> New.Creation FROM Temp;
> INNER JOIN New ON Temp.Numero=New.Numero;
> ORDER BY 5 DESCENDING INTO CURSOR Temp
>
>
>where GetUrlArticleMagazine2() is:
>
>
>FUNCTION GetURLArticleMagazine2
>PARAMETERS tnMonth,tnYear,tnPage,tnType,tcUrl
>LOCAL lcURL
>lcURL=''
>IF tnType=2
>   lcURL=tcUrl
>   ELSE
>   lcURL='http://www.something...'
>ENDIF
>RETURN PADR(lcURL,250)
>
>
>Is this the proper way to do it in VFP 8?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform