Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed Needed
Message
From
23/05/2011 12:08:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Speed Needed
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01511481
Message ID:
01511481
Views:
131
Dear Experts,

I have following codes, it takes more than 2 minutes to display results.
Is it possible to to make these more speedy?
Select Master
Replace All pqty With qty

Select purchase
Replace All pqty With qty

saleamount=0
cur_code=""
Select sales
End=Reccount()

** for loop to scroll on sales.dbf
For ak=1 To End
	saleamount=0
	cur_code=""

	Select sales
	Goto ak
	endloop=qty
	cur_code=Alltrim(codes)

	Select purchase
	Do While endloop>0

		Select Master

		Locate For Alltrim(codes)=Allt(cur_code) And pqty>0
		If Found()
			If pqty>endloop
				Replace sold With endloop
				saleamount=sold*Master.rate
				Replace pqty With pqty-endloop
				endloop=0
				Exit
			Else
				endloop=endloop-pqty
				Replace sold With pqty
				saleamount=saleamount+(sold*rate)
				Replace pqty With 0
			Endif
		Endif

		Select purchase

		Locate For Allt(codes)=Allt(cur_code) And pqty>0
		If Found()
			If pqty>endloop
				Replace sold With endloop
				saleamount=saleamount+(sold*purchase.rate)
				Replace pqty With pqty-endloop
				endloop=0
				Exit
			Else
				endloop=endloop-pqty
				Replace sold With pqty
				saleamount=saleamount+(sold*rate)
				Replace pqty With 0
			Endif
		Else
			Exit
		Endif
	Enddo
	Select sales
	Replace amount With Round(saleamount,0)
Endfor
Next
Reply
Map
View

Click here to load this message in the networking platform