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

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

Postby ukoenig » Fri Apr 11, 2008 10:46 am

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
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

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

Postby Richard Chidiak » Fri Apr 11, 2008 10:51 am

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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Detlef Hoefner » Fri Apr 11, 2008 10:53 am

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
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Seek on numeric fields

Postby ukoenig » Fri Apr 11, 2008 11:01 am

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 82 guests