Board index » delphi » creating secondary index in paradox table at runtime??

creating secondary index in paradox table at runtime??

Hi Gregory,

try the TTable.AddIndex function

Hope this helps

Andreas

In article <[email protected]>, [email protected] says...

Quote

>i am trying (i stress trying) to provide a data export feature in a
>program.  the problem lies in creating the secondary indexes required by
>the other software package.  i can create the table, the key, and pump in
>the data, but the secondary index definition remains a mystery.  any clues
>would be appreciated.

>thanx

>gregory liss
>applied technologies software engineer
>[email protected]

--
=============================================
helicon software development - Andreas Prucha
Baden/Vienna, Austria - heli.[email protected]
===Sorry, no kangaroos - Schnitzel instead===
 

Re:creating secondary index in paradox table at runtime??


i am trying (i stress trying) to provide a data export feature in a
program.  the problem lies in creating the secondary indexes required by
the other software package.  i can create the table, the key, and pump in
the data, but the secondary index definition remains a mystery.  any clues
would be appreciated.

thanx

gregory liss
applied technologies software engineer
[email protected]

Re:creating secondary index in paradox table at runtime??


Quote
Fuzzyface wrote:

> i am trying (i stress trying) to provide a data export feature in a
> program.  the problem lies in creating the secondary indexes required by
> the other software package.  i can create the table, the key, and pump in
> the data, but the secondary index definition remains a mystery.  any clues
> would be appreciated.

> thanx

I recently discovered that with Paradox tables, secondary indexes must
have the same name as the field that you're indexing on. So, if your
field is 'LASTNAME', the secondary index must also be 'LASTNAME'.
Probably not a problem if you're using the Database Desktop/Explorer.
However, I was creating my tables and indexes at run-time, as you
indicate.

Hope this helps.

Brent DeShazer

Re:creating secondary index in paradox table at runtime??


"I recently discovered that with Paradox tables, secondary indexes must
have the same name as the field that you're indexing on"

Whoa!  I don't think this is true.

To answer the original question: use AddIndex.  For example,

Say Table1 has fields named Code, Product, Price, Surname, FirstName,
Date1, Date2

and the primary index is on Code.

To create a secondary index use:

procedure AddAnIndex;
var MyIndexName, FieldList:string; Options: TIndexOptions;
begin
MyIndexName:= 'AnyNameYouLike';
FieldList:='Surname;FirstName'; {for DBase use: FieldList:='Surname +
FirstName';}
Options:= []; {for a DBase expression index use: Options:= [ixExpression];}
Table1.AddIndex(MyIndexName, FieldList, Options);
end;

{TIndexOptions = set of (ixPrimary, ixUnique, ixDescending,
ixCaseInsensitive, ixExpression);}

--
Paul Motyer  17:31 Thurs, 5th September, 1996 EST
[email protected]
SoftStuff, Croydon, Vic,  Australia, 3136.
Brent DeShazer <[email protected]> wrote in article
<[email protected]>...

Quote
> Fuzzyface wrote:

> > i am trying (i stress trying) to provide a data export feature in a
> > program.  the problem lies in creating the secondary indexes required
by
> > the other software package.  i can create the table, the key, and pump
in
> > the data, but the secondary index definition remains a mystery.  any
clues
> > would be appreciated.

> > thanx

> I recently discovered that with Paradox tables, secondary indexes must
> have the same name as the field that you're indexing on. So, if your
> field is 'LASTNAME', the secondary index must also be 'LASTNAME'.
> Probably not a problem if you're using the Database Desktop/Explorer.
> However, I was creating my tables and indexes at run-time, as you
> indicate.

> Hope this helps.

> Brent DeShazer

Re:creating secondary index in paradox table at runtime??


Thanks to all who posted answers to this problem.  I was working on the
same thing and was unsuccessful until I saw this thread.

Melody  :-)

Quote
Brent DeShazer wrote:

> Fuzzyface wrote:

> > i am trying (i stress trying) to provide a data export feature in a
> > program.  the problem lies in creating the secondary indexes required by
> > the other software package.  i can create the table, the key, and pump in
> > the data, but the secondary index definition remains a mystery.  any clues
> > would be appreciated.

> > thanx

> I recently discovered that with Paradox tables, secondary indexes must
> have the same name as the field that you're indexing on. So, if your
> field is 'LASTNAME', the secondary index must also be 'LASTNAME'.
> Probably not a problem if you're using the Database Desktop/Explorer.
> However, I was creating my tables and indexes at run-time, as you
> indicate.

> Hope this helps.

> Brent DeShazer

Other Threads