Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid character value for cast specification
Message
From
03/10/2008 15:40:11
 
 
To
03/10/2008 15:19:32
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01352659
Message ID:
01352679
Views:
26
Please pardon me for jumping in. The line LOCATE FOR ALLTRIM(Tmplignes.CODEARTICLE)=ALLTRIM(Tarticles.codearticle) is DANGEROUS!! First of all, don't use alltrim unleass you really need it! With Set Exact Off, your line will fine many records which you don't want!

Do a test, for instance Select * from custable where alltrim(lastname)='A'. You will select all records where lastname starts with 'A', most likely not what you want. In your case I suggest LOCATE FOR Tmplignes.CODEARTICLE=Tarticles.codearticle.


>HERE MY CODE :
>
>
>
>sele Tmplignes
> GO TOP
>
>SCAN  
>  
>  SELECT Tarticles  
>
>
> LOCATE FOR ALLTRIM(Tmplignes.CODEARTICLE)=ALLTRIM(Tarticles.codearticle)
>   
>   IF FOUND()
>          	REPLACE  Tmplignes.asdi WITH Tarticles.asdi
>       		REPLACE  Tmplignes.tva WITH Tarticles.tva=Tarticles.asdi
>         
>         Vtva=Tmplignes.tva
>         Vasdi=Tmplignes.asdi 
>         
>         IF thiS.LISTINDEX=1
>           Vtva=0
>           Vasdi=0
>           REPLACE Tmplignes.tva WITH Vtva
>           REPLACE Tmplignes.asdi WITH Vasdi
>         ENDIF
>         
>         IF thiS.LISTINDEX=2
>           Vtva=Tmplignes.tva
>           Vasdi=0
>            REPLACE Tmplignes.tva WITH Vtva
>            REPLACE Tmplignes.asdi WITH Vasdi
>         ENDIF
>         
>         IF thiS.LISTINDEX=3
>           Vtva=Tmplignes.TVA
>           Vasdi=Tmplignes.asdi 
>            REPLACE Tmplignes.tva WITH Vtva
>            REPLACE Tmplignes.asdi WITH Vasdi
>         ENDIF
>         
>     *------------------------------------
>       
>
>       Vmtbase=(Tmplignes.prix_unitaire-(Tmplignes.prix_unitaire*(Tmplignes.remise/100)))*Tmplignes.quantite
>       VMontantaxe=(Tmplignes.prix_unitaire*(1-(Tmplignes.remise/100))*Tmplignes.quantite*(Tmplignes.tva/100))
>       VmtASDI=(Tmplignes.prix_unitaire*(1-(Tmplignes.remise/100))*Tmplignes.quantite)*(1+(Tmplignes.tva/100))*(Tmplignes.asdi/100)
>
>
>      
>     *------------------------------------
>     ENDIF
>
>ENDSCAN 
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform