Board index » delphi » Dbase and compound indexes

Dbase and compound indexes

I am using Delphi 4 and 5.

Is there a trick in using compound indexes on a DBase table? I mean if there
is an index, that contains two fields, it appears that DBase/Delphi ignores
the second field in the index. It just sorts the view on the first field.
Any thoughts?

TIA...

--
===========================
Scott Simonson
Student of Life!!!
Franklin, WI
ICQ# 13330413
The PACK will be back!!!
===========================

 

Re:Dbase and compound indexes


Compound indexes will sort correctly.   However you can't just
concatenate field names using semi-colons as you can with paradox.

In dBase, you use expression indexes.   For instance, say you wanted
an index sorted primarily by lastname and secondarily by firstname.

In dBase you would create an expression index using the expression
"LASTNAME + FIRSTNAME"  or, to make it case insensitive
"UPPER(LASTNAME + FIRSTNAME)".   There can be multiple indexes
contained in one physical .mdx index file.   Each individual index is
referred to by its index tag name.

If the index described above had the tagname "BYNAME" and you set the
TTable's IndexName to 'BYNAME', then it will sort correctly.   Note:
ignore the "IndexFiles" property - That is for use with the older .ndx
indexes and for non-structural indexes.  Also avoid the
"IndexFieldNames" property.

Regards,
Colin Acheson

On Tue, 25 Jul 2000 22:11:34 -0500, "Scott Simonson"

Quote
<SSimon...@wi.rr.com> wrote:
>I am using Delphi 4 and 5.

>Is there a trick in using compound indexes on a DBase table? I mean if there
>is an index, that contains two fields, it appears that DBase/Delphi ignores
>the second field in the index. It just sorts the view on the first field.
>Any thoughts?

Other Threads