Board index » delphi » Problem with concatenated column indexes in DBF files and MDX indexes

Problem with concatenated column indexes in DBF files and MDX indexes

I am porting an application that was written in TP to Delphi. It used DBF
files but a proprietary index structure (in fact, it used routines from
Topaz). One of the indexes was a composite index consisting of the
concatenation of two string fields.

I have created MDX indexes  with the same two contiguous string fields
concatenated using the Database Desktop and have successfully opened the files
under Delphi. But as soon as I try to use Findkey on a table
(table1.findkey([edit1.text])  that has the composite index defined, Delphi
issues the message:

Cannot use array of field values with Expression indices

Is this a limitation of the BDE and/or DBF files or am I doing something wrong
in the coding? When I use a single column index it works fine

Thanks

Laurence Chiu

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

 

Re:Problem with concatenated column indexes in DBF files and MDX indexes


Well, Borland seems to have forgotten expression indexes ...
So, I encountered the same problem several months ago. The way to solve the
problem :

1) Make sure that your expression is like : <field1>+<field2>+...+<fieldN>
2) Use the old function 'GotoNearest' to reach the record. For example  :
       Table1.SetKey;
       Table1.FieldByName('Field1').AsString := Label1.caption;
       Table1.FieldByName('Field2').AsString := Label2.caption;
       Table1.GotoNearest;

If you want to get further information about expression indexes, read the
TI2838 available on this web.

Emmanuel.

Quote

>Is this a limitation of the BDE and/or DBF files or am I doing something
wrong
>in the coding? When I use a single column index it works fine

>Thanks

>Laurence Chiu

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading

Re:Problem with concatenated column indexes in DBF files and MDX indexes


In article <6e3nru$7i...@forums.borland.com>,
  "EP" <eper...@cielsoft.com> wrote:

Quote
> 1) Make sure that your expression is like : <field1>+<field2>+...+<fieldN>
> 2) Use the old function 'GotoNearest' to reach the record. For example  :
>        Table1.SetKey;
>        Table1.FieldByName('Field1').AsString := Label1.caption;
>        Table1.FieldByName('Field2').AsString := Label2.caption;
>        Table1.GotoNearest;

thanks - that seemed to do the trick

Quote

> If you want to get further information about expression indexes, read the
> TI2838 available on this web.

Couldn't find this - where would one look for it?

Thanks

Laurence Chiu

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

Other Threads