Page 1 of 1

Strange Index problem for ADS RDD

Posted: Mon Sep 03, 2007 6:26 am
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

Posted: Mon Sep 03, 2007 7:13 am
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

Posted: Mon Sep 03, 2007 8:01 am
by kokookao2007
HI Detlef :
SET INDEX TO ITEM
SAME !!

Posted: Mon Sep 03, 2007 10:06 am
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

Posted: Mon Sep 03, 2007 5:11 pm
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

Posted: Mon Sep 03, 2007 6:53 pm
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

Posted: Mon Sep 03, 2007 9:14 pm
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()

Posted: Tue Sep 04, 2007 3:21 am
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

Posted: Wed Sep 05, 2007 6:11 am
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 ?

Posted: Wed Sep 05, 2007 3:49 pm
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

Posted: Wed Sep 05, 2007 4:31 pm
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

Posted: Thu Sep 06, 2007 2:23 am
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

Posted: Thu Sep 06, 2007 5:41 am
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

Posted: Mon Sep 10, 2007 1:51 am
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