Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why these two commands will give different results
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01174441
Message ID:
01174623
Views:
7
>>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform