FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange Index problem for ADS RDD
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 06: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

-------------

best regards

kokoo Kao
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 07:13 AM
kokookao2007,

plerase try as the following ...
USE ITEM NEW EXCL 
INDEX ON NO TO ITEM 
SET INDEX TO ITEM
BROWSE()

hth,
Regards,
Detlef
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 08:01 AM
HI Detlef :

SET INDEX TO ITEM


SAME !!
-------------

best regards

kokoo Kao
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 10:06 AM
kokookao2007,

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

But what happens if you code
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
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 05: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 :

#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]


Which version of ADS you are using ?


Regards

- Ramesh Babu P
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 06: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

Posts: 840
Joined: Thu Oct 13, 2005 07:05 PM
Strange Index problem for ADS RDD
Posted: Mon Sep 03, 2007 09: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.
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Tue Sep 04, 2007 03: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
-------------

best regards

kokoo Kao
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Wed Sep 05, 2007 06: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 ?
-------------

best regards

kokoo Kao
Posts: 840
Joined: Thu Oct 13, 2005 07:05 PM
Strange Index problem for ADS RDD
Posted: Wed Sep 05, 2007 03: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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Strange Index problem for ADS RDD
Posted: Wed Sep 05, 2007 04: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Thu Sep 06, 2007 02: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
-------------

best regards

kokoo Kao
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Strange Index problem for ADS RDD
Posted: Thu Sep 06, 2007 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 59
Joined: Thu May 17, 2007 08:27 AM
Strange Index problem for ADS RDD
Posted: Mon Sep 10, 2007 01: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
-------------

best regards

kokoo Kao

Continue the discussion