Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why these two commands will give different results
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01174441
Message ID:
01174623
Vues:
8
>>>I haven't figured why I was getting different results, but I decided to move on.
>>
>>Check COUNT(*) vs COUNT, are they equals.
>
>I can not reproduce this problem now.
>
> SET ORDER TO com_inv IN comision
>                IF SEEK(m.ccinv + m.Slsman)
>                	
>					*SUM (rate*SHARE/10000) TO cRate WHILE inv_no+salesman = m.ccinv + m.Slsman
>					SELECT SUM(rate*SHARE/10000) AS crate WHERE inv_no+salesman = m.ccinv + m.Slsman ;
>                	FROM comision INTO ARRAY laArr
>*!*	                	IF NOT m.cRate == laArr[1]
>*!*	                		=MESSAGEBOX("Found a mismatch on " + m.ccinv + m.Slsman)
>*!*	                		_cliptext = _cliptext + "Found a mismatch on " + m.ccinv + m.Slsman + " cRate = " + ;
>*!*	                		         	TRANSFORM(m.cRate)  + " laArr[1]= " + TRANSFORM(laArr[1])
>*!*	                	ENDIF
>                	cRate = laArr[1]	         	
>				ELSE && Not found
>					cRate = 0
>				endif	
>
>With SEEK before select both return the exact same amount.

However, if I comment SEEK before SELECT like this
 SET ORDER TO com_inv IN comision
               * IF SEEK(m.ccinv + m.Slsman)
                	
					*SUM (rate*SHARE/10000) TO cRate WHILE inv_no+salesman = m.ccinv + m.Slsman
					SELECT SUM(rate*SHARE/10000) AS crate WHERE inv_no+salesman = m.ccinv + m.Slsman ;
                	FROM comision INTO ARRAY laArr
                	
*!*	                	IF NOT m.cRate == laArr[1]
*!*	                		=MESSAGEBOX("Found a mismatch on " + m.ccinv + m.Slsman)
*!*	                		_cliptext = _cliptext + "Found a mismatch on " + m.ccinv + m.Slsman + " cRate = " + ;
*!*	                		         	TRANSFORM(m.cRate)  + " laArr[1]= " + TRANSFORM(laArr[1])
*!*	                	ENDIF
                	cRate = EVL(laArr[1],0)	         	
			*	ELSE && Not found
			*		cRate = 0
			*	endif	 
I get a different result. Why would SEEK make such difference?
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