Can't get IndexFieldNames to work
Posted on 1998-11-17
I'm working with D3 and FoxPro tables.
I clearly have many indexes on my table. I can see them in the DBD as well as the DB Explorer, AND I can use them in the table.IndexName property.
That all works fine..
But when I do: table.IndexFieldNames := 'field1;field2';
It barfs on me and says that it can't find the index.
Am I doing this correctly?
To actually state what I am TRYING to accomplish with this, I have a two tables. One is on a CD and one is on the hard drive. Every month the user will get a new CD and I have to update the hard drive table with new records... BUT I can't overwrite any previous records.
This condition is based off of two fields: ELEMENT and TYPE
If the same element and type are on the hard drive, the record is not copied over. Pretty simple..
So I have an index on both of these fields. I tried making one index with both fields but it seems FoxPro/DBASE doesn't let me do this. :(
Using the FindKey([value]) allows me to jump to element number really quickly and see if it's there. But since there can be multiple elements with different types and this only gives me the first one, I need to find a way to jump to the given type as well.
So I'm trying to make the TTable use two indexes and hopefully FindKey([element, type]) will work.
Is there an easier way to quickly tell if a record is in a table based on two fields? I need this to be quick because there are possibly hundreds of thousands of records on the CD that need to be updated.