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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only