Solved

Invalid Index Descriptor

Posted on 2001-06-12
5
1,635 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

22 Experts available now in Live!

Get 1:1 Help Now