Board index » delphi » INDEXING ON A SUBSTRING

INDEXING ON A SUBSTRING

Need to build an index based upon a substring of a Field in a Table.   For
example, a field called CONTROL
has 14 characters.

Here is what a typical entry into the CONTROL field would look like:

MISC 000300052

I need to index the table by the last 5 characters in that field.   The
field is a String Type.

Is that possible?  How, exactly, would that be done.

In xBase,  the line of code would be:

     Index On SubStr(CONTROL,10,5) to SomeIndex

Thanks

Richard Wakeman
wake...@thegrid.net

 

Re:INDEXING ON A SUBSTRING


On Thu, 6 Jan 2000 12:46:49 -0800, "Richard Wakeman" <wake...@thegrid.net>
wrote:

Quote
>Need to build an index based upon a substring of a Field in a Table.   For
>example, a field called CONTROL
>has 14 characters.

>Here is what a typical entry into the CONTROL field would look like:

>MISC 000300052

>I need to index the table by the last 5 characters in that field.   The
>field is a String Type.

>Is that possible?  How, exactly, would that be done.

>In xBase,  the line of code would be:

>     Index On SubStr(CONTROL,10,5) to SomeIndex

AFAIK, you can only do this with dBASE or xBASE tables using an expression
index. In Delphi, this looks like:

  Table1.AddIndex('IdxName', 'UBSTR(CONTROL, 10, 5)',
    [ixExpression], '');

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Other Threads