A easy way, to do incremental seek on numeric fields ?

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

A easy way, to do incremental seek on numeric fields ?

Post by ukoenig »

Hello,

In a old program of mine, there is a index on
numeric Customer-Numbers ( CDX ).

The index is => Index on STR(number)
index on LTRIM(STR(number)) doesn't work.

When you do a seek on this field ( N 5 0 )
as a sample you seek < 5 > you have to do - - - - 5
4 blanks + "5"

Must i write a function for this ?

Regards

Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Re: A easy way, to do incremental seek on numeric fields ?

Post by Richard Chidiak »

Uwe

Index on numeric work fine

index on number to ....

and then seek 5 or whatever else

no problem with it, i have many numeric indexs in my app

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

Uwe,
index on LTRIM(STR(number)) doesn't work.
this is normal because all index keys need to be of constant same length.

Moreover it's a bad design to use numeric fields for indexing.
They are better used for numeric operation / calculation.

If you can't avoid it i'd take 'strzero( nVal, nLen, nDec )' for indexing and searching.

Regards,
Detlef
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Seek on numeric fields

Post by ukoenig »

Detlef Thank you,

Yes it is a very old application and
to much work to change it.

I will try Strzero

Regards

Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply