Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Invalid Index Descriptor

Posted on 2001-06-12
5
1,658 Views
Last Modified: 2012-06-27

Why am I getting the "Invalid Index Descriptor" error when I try to create this DB at runtime?

I want to create a DBase table named Index.dbf with a maintained index called Index.mdx, indexing on Field 'Descr'.

var NewTable : TTable;
...
NewTable := TTable.Create(fPickDir); // fPickDir is current form
NewTable.Active := False;
NewTable.TableName := sDummy; // sDummy is path+'index.dbf'
NewTable.TableType := ttDBase;
NewTable.FieldDefs.Clear;
NewTable.FieldDefs.Add('DESCR', ftString, 50, False);
NewTable.FieldDefs.Add('FILENAME', ftString, 50, False);
NewTable.IndexDefs.Clear;
NewTable.IndexDefs.Add('Index','Descr',[ixExpression]);
NewTable.CreateTable;  // ** Error Happens Here
NewTable.Free;

Thanks in advance,
WKHays
0
Comment
Question by:wkhays
5 Comments
 
LVL 1

Expert Comment

by:Phoenix_s
ID: 6183624
sounds like the BDE is having a fir because you names the index, INDEX.

try to change the index name to something like

IX_DESCR  which will make the index file IX_DESCR.MDX

if you have any other indexes you need set up, it might be an idea to adhere to a standard naming convention for all indexes utilizing IX_<field-indexed>

so that if there was a field called user which needed indexing, the index would be names IX_USER, which would then create a file called IX_USER.MDX.

hope this helps
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6185336
guessing the expression is missed in the index-definition
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6185340
try

NewTable.IndexDefs.Add('Index','Descr',[ixPrimary]);
0
 
LVL 17

Accepted Solution

by:
geobul earned 50 total points
ID: 6185712
Hi,

...
NewTable.IndexDefs.Clear;
NewTable.CreateTable;
NewTable.AddIndex('Index','Descr',[ixExpression]);
NewTable.Free;

Regards, Geo
0
 
LVL 4

Author Comment

by:wkhays
ID: 6188414
Thanks all:

Phoenix - I really want my index to be called index.mdx to match a file called index.dbf... There are already dozens of these in existence that were manually made ... To late to change the convention.

kretzschmar - According to the online help, [ixPrimary] is not valid for DBase files.

GeoBul - Works like a charm... Thanks!!!

-WKHays

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

828 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