Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where Clause Problem
Message
 
 
À
13/03/2009 12:37:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01387776
Message ID:
01387782
Vues:
61
Al,

I think you've been "around the block" long enough to know not to use EVALUATE with SQL :)

>>Hi All,
>>
>>This code give no error
>>
>>
>>
>>m.cCondit = '.T.'
>>
>> SELECT DISTINCT ;
>>   E.nType ,;
>>   R.lassimille , ;
>>   CAST( ICASE( INLIST( .F. , E.ltransfert , M.lcondit ) , E.ltransfert ,;
>>   ICASE( D.ddate <= m.dlimit , .T. , .F. )) AS L ) AS ltransfert ,;
>>   NVL( SUM( ICASE( E.nPosCat = 1 , 1 , 0 ) ) , 0 ) AS nCat_O,;
>>   NVL( SUM( ICASE( E.nPosCat = 2 , 1 , 0 ) ) , 0 ) AS nCat_A,;
>>   NVL( SUM( ICASE( E.nPosCat = 3 , 1 , 0 ) ) , 0 ) AS nCat_B,;
>>   NVL( SUM( ICASE( E.nPosCat = 4 , 1 , 0 ) ) , 0 ) AS nCat_C,;
>>   NVL( SUM( ICASE( E.nPosCat = 5 , 1 , 0 ) ) , 0 ) AS nCat_Cd;
>>   FROM  amline!Etats E;
>>   INNER JOIN DatesFiltred D ON D.ddate BETW E.ddebut AND EVL( E.dfin , m.dfin ) ;
>>   INNER JOIN amline!Resident R ON R.iid = E.iresidentid  ;
>>WHERE R.iid = 3065 GROUP BY 1,2,3 INTO CURSOR Categ READWRITE
>> 
>>
>>
>>But This code code give bad result
>>
>>
>>m.cCondit = "R.iid=" + TRANSF( 3065 )
>>
>>SELECT DISTINCT ;
>>   E.nType ,;
>>   R.lassimille , ;
>>   CAST( ICASE( INLIST( .F. , E.ltransfert , M.lcondit ) , E.ltransfert ,;
>>   ICASE( D.ddate <= m.dlimit , .T. , .F. )) AS L ) AS ltransfert ,;
>>   NVL( SUM( ICASE( E.nPosCat = 1 , 1 , 0 ) ) , 0 ) AS nCat_O,;
>>   NVL( SUM( ICASE( E.nPosCat = 2 , 1 , 0 ) ) , 0 ) AS nCat_A,;
>>   NVL( SUM( ICASE( E.nPosCat = 3 , 1 , 0 ) ) , 0 ) AS nCat_B,;
>>   NVL( SUM( ICASE( E.nPosCat = 4 , 1 , 0 ) ) , 0 ) AS nCat_C,;
>>   NVL( SUM( ICASE( E.nPosCat = 5 , 1 , 0 ) ) , 0 ) AS nCat_Cd;
>>   FROM  amline!Etats E;
>>   INNER JOIN DatesFiltred D ON D.ddate BETW E.ddebut AND EVL( E.dfin , m.dfin ) ;
>>   INNER JOIN amline!Resident R  ON R.iid = E.iresidentid  ;
>> WHERE EVAL( m.cCondit )=.T. GROUP BY 1,2,3 INTO CURSOR Categ READWRITE
>>
>>
>
>1. Is m.cCondit in scope when the SELECT executes?
>
>2. For the WHERE clause you could try
>
>WHERE EVAL( m.cCondit )  && don't need the =.T.
>
>* or maybe
>
>WHERE EVALUATE( m.cCondit )
>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform