Strange Index problem for ADS RDD

Strange Index problem for ADS RDD

Postby kokookao2007 » Mon Sep 03, 2007 6:26 am

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
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Postby Detlef Hoefner » Mon Sep 03, 2007 7:13 am

kokookao2007,

plerase try as the following ...
Code: Select all  Expand view  RUN
USE ITEM NEW EXCL
INDEX ON NO TO ITEM
SET INDEX TO ITEM
BROWSE()

hth,
Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby kokookao2007 » Mon Sep 03, 2007 8:01 am

HI Detlef :

SET INDEX TO ITEM


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

Postby Detlef Hoefner » Mon Sep 03, 2007 10:06 am

kokookao2007,

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

But what happens if you code
Code: Select all  Expand view  RUN
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
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby RAMESHBABU » Mon Sep 03, 2007 5:11 pm

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  Expand view  RUN

#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
RAMESHBABU
 
Posts: 625
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Rick Lipkin » Mon Sep 03, 2007 6:53 pm

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
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby R.F. » Mon Sep 03, 2007 9:14 pm

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.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby kokookao2007 » Tue Sep 04, 2007 3:21 am

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/xharbour/index_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

Postby kokookao2007 » Wed Sep 05, 2007 6:11 am

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 ?
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Postby R.F. » Wed Sep 05, 2007 3:49 pm

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.
R.F.
 
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Postby James Bott » Wed Sep 05, 2007 4:31 pm

>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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby kokookao2007 » Thu Sep 06, 2007 2:23 am

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
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Postby James Bott » Thu Sep 06, 2007 5:41 am

>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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby kokookao2007 » Mon Sep 10, 2007 1:51 am

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
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

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