Strange Index problem for ADS RDD

Post Reply
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Strange Index problem for ADS RDD

Post by kokookao2007 »

hi all :

I have a item database whice has a normal index key.

But the sort was very strange .

NO (item.dbf)
=================
HST-1002-1
HST-1002
HST-1002-2
HST-1002-4
HST-1002-3

USE ITEM NEW EXCL
INDEX ON NO TO ITEM
BROWSE()

show in ADS RDD:
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4
HST-1002 ==> shoule be first

should be:
HST-1002
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4

Anyone know about it ?

--
Best Regards
-----------------
kokoo KAO
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

kokookao2007,

plerase try as the following ...

Code: Select all

USE ITEM NEW EXCL 
INDEX ON NO TO ITEM 
SET INDEX TO ITEM
BROWSE() 
hth,
Regards,
Detlef
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Post by kokookao2007 »

HI Detlef :
SET INDEX TO ITEM
SAME !!
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post by Detlef Hoefner »

kokookao2007,

i'm sorry but i've no experience with ADS.

But what happens if you code

Code: Select all

USE ITEM NEW EXCL 
INDEX ON NO TO ITEM 
SET INDEX TO ITEM 
item->( dbGoTop() )
BROWSE() 
If it's still the same, you should ask our ADS master, RF for help.

Regards,
Detlef
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

Hello Mr.kokoo KAO

I am using ADS 7.10 and I am getting the same result what you are
expecting. And this is the result browse screen of the test program :

Code: Select all


#include "fivewin.ch"
#include "ads.ch"

FUNCTION main()

* Advantage Database Server Settings
REQUEST ADS, ADSKeyCount, ADSKeyNo, OrdKeyCount, OrdKeyNo

rddRegister( "ADS", 2 )
rddsetdefault( "ADS" )
SET SERVER LOCAL
SET FILETYPE TO CDX
AdsSetDeleted(.T.)

?adsversion()

USE adsindex.asc
INDEX ON adsindex->no TO adsindex
SET INDEX TO adsindex

BROWSE()

RETURN nil


AND THE RESULT SCREEN IS :

http://img129.imageshack.us/my.php?imag ... dexer2.png]Image


Which version of ADS you are using ?


Regards

- Ramesh Babu P
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

To All

Do not use a database pointer in the creation of your indexes ..

USE adsindex.asc
INDEX ON adsindex->no TO adsindex
SET INDEX TO adsindex


INDEX on no To adsindex ..

Rick Lipkin
SC Dept of Health, USA
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post by R.F. »

The Following code, tested under ADS 7.1 and 8.1 works as expected, in both CDX and NTX file formats:

Test were made with xHarbour 99.61

REQUEST ADS
RDDSETDEFAULT("ADS")
AdsSetServerType(7)
AdsSetFileType(1)
USE kokoo
INDEX ON NO TO kokoo
Browse()
Saludos
R.F.
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Post by kokookao2007 »

hi all:
?adsversion() ==> 8.10
Do not use a database pointer in the creation of your indexes ..

INDEX ON adsindex->no TO adsindex
INDEX ON no TO adsindex

==> same
my xHarbour version :99.70
what my screen image:
http://kokookao.myweb.hinet.net/xharbou ... browse.jpg

try edit item no:

HST-1002-1
HST-1002 ==>HST-1002-
HST-1002-2
HST-1002-4
HST-1002-3

BROWSE():
HST-1002- ==>first now
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4

why HST-1002 can not sort in first ?
bug or library problem ?
it is correct sort in "dbfcdx" rdd .

--
Best Regards
-----------------
kokoo KAO
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Post by kokookao2007 »

try xHarbour 0.99.61 ==>same problem

database browse field NO:
================
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4
HST-1002
===============

cITEM:="HST-1002"+SPACE(2)

DBSEEK(cITEM) //==> Correct
DBSEEK(TRIM(cITEM)) //==> not Correct , seek "HST-1002-1"
looks like a bug ?
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post by R.F. »

Curious thing:

If you add a "-" at the end it sorts acording to what you need, if you leave a space instead of the "-" it sends to the end of the indexed item.

Let me check with xHarbour.com
Saludos
R.F.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

>DBSEEK(TRIM(cITEM)) //==> not Correct , seek "HST-1002-1"

This is not a bug, it is correctly finding the first match to "HST-1002" which is 'HST-1002-1"

If you want to seek for an exact match, you always have pad the search item to the length of the field being seeked.

James
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Post by kokookao2007 »

hi James :
Thank you for reply.
IN RDD "DBFCDX" FIELD NO:
================
HST-1002
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4
===============
DBSEEK(TRIM(cITEM)) //==> "HST-1002 "

IN RDD "ADS" FIELD NO:
================
HST-1002-1
HST-1002-2
HST-1002-3
HST-1002-4
HST-1002
===============
DBSEEK(TRIM(cITEM)) //==> "HST-1002-1"
What my problem is the Index Sorting not correct , not dbseek() problem.

--
Best Regards
-----------------
kokoo KAO
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

>What my problem is the Index Sorting not correct , not dbseek() problem.

I understand about the index problem and I don't have an answer for that.

For the seek, it appears that the ADS RDD is incorrect.

James
User avatar
kokookao2007
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Post by kokookao2007 »

hi all:

Should I edit any includ file code for RDD "ADS" ?

#include "fivewin.ch"
#include "ads.ch"

RddRegister( "ADS", 1 )
RddSetDefault( "ADS" )

SET FILETYPE TO CDX

AdsSetServerType(1) //local
AdsSetDeleted(.T.)

USE ITEM NEW EXCL
INDEX ON ITEM->NO TO ITEM
=>
dbUseArea(.T.,,"ITEM",,if(.F. .or. .T.,!.T.,NIL),.F. )
dbCreateIndex((FILE_TH + "ITEM"),"ITEM->NO",{||ITEM->NO},IIF(.F.,.t.,NIL ) )

Now the "Index on " command transfer form fwstd.ch.
Best Regards
-----------------
kokoo KAO
Post Reply