Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed Needed
Message
From
23/05/2011 15:48:40
 
 
To
23/05/2011 12:08:18
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
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:
01511500
Views:
75
I have NOT checked if the code can be written to be more effective,
but all your locates are on trimmed values. These cannot be speeded up with an index -
but comparisons with padr(value, LensetBeforeLoopAccordingToFieldLen) could.

HTH

thomas

>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
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform