Solved

Can't get IndexFieldNames to work

Posted on 1998-11-17
8
330 Views
Last Modified: 2010-04-04
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.  

Will it?

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.  

Thanks,
joe

0
Comment
Question by:greendot2
8 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1347161
background info : version of bde?
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1347162
As Zif said, upgrade to BDE 5.0/5.01 maybe a solution, since 4.51 yet have no direct support for foxPro tables.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1347163
hi greendot2,

you can use a query to insert the records based by your fields.

i.e

insert into destinationtable select * from your Sourcetable where field1||field2 not in (select field1||field2 from your destinationtable)

if one or both fields numeric-typ then you can convert it to string by use of
cast(field1 as character)||field2

or

cast(field1 as character)||cast(field2 as character)

it works with paradox (foxpro should work also)
field1 and field2 must concanated to build a temporary primary field.
depends on the count of records the query can take time.

meikl
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:greendot2
ID: 1347164
I'm using BDE 4.51, and this was the one that added native FoxPro drivers.  I have 4.0, 4.51, and 5.0 and tested each one.  4.51 is the most stable.  We tried 5.0 but the LocalSQL engine hung more times than it worked. (only on the foxpro tables, it worked fine with Paradox).

I've managed to get it working with a filter, without much of a performance hit.  I'll try inserting them with SQL today and see how smooth that is.

Thanks,
joe
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1347165
hi greendot2,

have you test it? For assistance response!

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1347166
Hello?
0
 

Author Comment

by:greendot2
ID: 1347167
Go ahead and post an answer.. I'll give you the points.
I never actually got around to finishing this problem.
I'll pick it up in a few months.




0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
ID: 1347168
hi greendot2,

ok, here is the answer
good luck again in a few month
i am really interesting about this solution work
if you apply this response to my eMail kretzschmar@techsupport.de

meikl
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
Convert Jpg /PNG To GIF 5 134
Delphi Dbf export problem to a Visual Foxpro application 6 187
Firemonkey webbrowser scrollbars ? 1 36
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now