Board index » delphi » INDEX ON A SUBSTRING

INDEX 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:INDEX ON A SUBSTRING


1. You forgot to mention what DB you are using.
2. If you are using Paradox, Access, or any major
    RDBMS, you won't be able to do that...

Quote
Richard Wakeman <wake...@thegrid.net> wrote in message

news:Ub7d4.6849$Fn6.1075882@alfalfa.thegrid.net...
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

> Thanks

Re:INDEX ON A SUBSTRING


Thanks - Am Using Dbase Table (dbf).   Did get an answer, though.   Simple.
Just build index with an expression using  Right().  As such:

    AddIndex('LAST5','RIGHT(CNUM,5)',[ixExpression]);

Seems to work!

R. Wakeman

Quote
Just a Newsguy wrote in message <85379c0...@news2.newsguy.com>...
>1. You forgot to mention what DB you are using.
>2. If you are using Paradox, Access, or any major
>    RDBMS, you won't be able to do that...

>Richard Wakeman <wake...@thegrid.net> wrote in message
>news:Ub7d4.6849$Fn6.1075882@alfalfa.thegrid.net...
>> 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

Other Threads