Link to home
Start Free TrialLog in
Avatar of wkhays
wkhays

asked on

Invalid Index Descriptor


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
Avatar of Phoenix_s
Phoenix_s

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
Avatar of kretzschmar
guessing the expression is missed in the index-definition
try

NewTable.IndexDefs.Add('Index','Descr',[ixPrimary]);
ASKER CERTIFIED SOLUTION
Avatar of geobul
geobul

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wkhays

ASKER

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