Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SEEK or LOCATE?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00253099
Message ID:
00254006
Views:
31
I have been following this thread and have a question to ask concerning SEEK versus LOCATE, but first I need to paint the picture for all to see. It is my understanding that in order to maximize the speed of an application's data access that a programmer is advised to use integer fields. However, when you have to tables, such as invoice header and invoice line items, the invoice line items table will have two integer fields -- lineid (which is not the same as linenumber, but rather is the primary key for the table) and invoiceid (which is, obviously, used to relate the line item to the invoice header table.) Suppose you would like to seek a using lineid and invoiceid to a particular record. You would have to create an index on ALLTRIM(STR(lineid)) + ALLTRIM(STR(invoiceid)) in order for the seek to work. This essentially eliminiates (according to my interpretation of VFP Adivisor) the advantage of using integers.

Now, my question then becomes, is it more advisable to use character fields for the primary key with compound indexes and seek to find specific records, or are you better to use integer fields with individual indexes combinded with a 'LOCATE FOR this = that AND here = there'?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform