Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locate for command slow
Message
From
24/04/2005 13:22:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01007905
Message ID:
01007906
Views:
11
First, a LOCATE command based on ALLTRIM() will not be optimized, since you will not have an index on ALLTRIM() (at least, I hope you don't - indices must be of fixed size).

Second, in general, the SEEK command or the SEEK() function will be much faster than any alternative which simply relies on VFP optimization. Methinks you already what you need with the index called "code" - use it.

One more thing: don't use "select 6" - using the alias will be much more readable, and easier for maintenance.


>in vfp9 locate for command slow down, with these codes
>
>
>sele 6
>set filter to
>set order to code
>*SET FILTER TO admtd=1.and.lcode=thisform.lcodec.value.and.sec=thisform.secc.value
>SET FILTER TO lcode=thisform.container4.lcodec.value.and.sec=thisform.container4.secc.value;
>.and.admtd=thisform.container4.inout.value
>
>
>locate for allt(code)=allt(thisform.code.value)
>if !bof()
>	skip -1
>	dis=1
>	this.parent.init
>endif
>thisform.container3.visible=.t.
>photo_file=allt(thisform.code.value)+".jpg"
>thisform.container3.image1.picture="stpics\"+(photo_file)
>ThisForm.ox.CalculateAge(ThisForm.dbirth.Value,ThisForm.text5.Value)
>ThisForm.year.value = ThisForm.ox.nYears
>ThisForm.month.value = ThisForm.ox.nMonths
>ThisForm.day.value = ThisForm.ox.nDays
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform