FOXCDX and integer

Xbase++ 2.0 Build 554 or later
Message
Author
skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

FOXCDX and integer

#1 Post by skiman »

Hi,

I need to read a FOXCDX database which has a CDX where the tag I need to search on is an INTEGER field. I don't succeed to do a dbseek on that field. It always returns an EOF().

I already tried with alias->(dbseek( int(nValue)) and also with alias->(dbseek( nValue, .F., cTagname)). After opening the file, there is a ordsetfocus to the correct tag. When I browse the file, the order is on that field.

I tried to search in that database with xdbu, and I also don't succeed.

Anyone who knows if it is possible to seek on an index where the key is an INTEGER field.
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: FOXCDX and integer

#2 Post by skiman »

Hi,

In attachment a sample dbf with the CDX file. If I try the following in xdot, it isn't working.

Code: Select all

cls
use artikel via foxcdx 
set index to artikel
ordsetfocus("artcode")
? indexkey()
q := 42300
dbseek(q)
? eof()
? a_artcode
? a_nummer
After the SEEK, the EOF is always .T..

Any help welcome.
Attachments
artikel.zip
(940.03 KiB) Downloaded 804 times
Best regards,

Chris.
www.aboservice.be

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: FOXCDX and integer

#3 Post by skiman »

I just realized that this is the 2.0 forum. This is an xbase 1.9 issue, probably also 2.0.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: FOXCDX and integer

#4 Post by rdonnay »

I have no problem seeking a numeric key.

I created a field named MYNUMBER, N, 5

I then created 2 index tags:
INDEX ON MYNUMBER TAG MYNUMBER
INDEX ON Int(MYNUMBER) TAG INUMBER

I filled the field like so:
REPLACE aLL MYNUMBER WITH Recno() + 11

Then I did a dbSeek(511).
It put me on record 500.

I tried this with both index tags.
I have never had a problem with numeric indexes.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: FOXCDX and integer

#5 Post by skiman »

Hi Roger,

Yes, I also have no problems with a numeric key.

However in a Foxpro database there is a fieldtype Integer. This seems to be the cause of this problem.

I you unzip the DBF with CDX you can see the problem.

I need to synchronize a dbf with data from another application. I can open the files and seek in them. This file has an indextag on an integer field which I need. This gives me the problem.
Best regards,

Chris.
www.aboservice.be

Zdeno Bielik
Posts: 147
Joined: Thu Jan 28, 2010 9:24 am
Location: Nitra, Slovakia
Contact:

Re: FOXCDX and integer

#6 Post by Zdeno Bielik »

Hi,

try set CDXDBE_MODE for COMPONENT_ORDER to CDXDBE_FOXPRO2X or to CDXDBE_VFOXPRO.

HTH
Zdeno

Code: Select all

****************
PROCEDURE dbeSys()
****************

Set Collation To SYSTEM

/*
IF ! DbeLoad( "DBFDBE", .T.)
   MsgBox( "Database engine DBFDBE not loaded" , {"OK"} )
ENDIF

IF ! DbeLoad( "CDXDBE",.T.)
   MsgBox( "Database-Engine CDXDBE not loaded" , {"OK"} )
ENDIF

IF ! DbeBuild( "DBFCDX", "DBFDBE", "CDXDBE" )
   MsgBox( "DBFCDX Database-Engine;is not created" , {"OK"} )
ENDIF

DbeSetDefault( "DBFCDX" )
*/

*

IF ! DbeLoad( "FOXDBE", .T.)
   MsgBox( "Database engine FOXDBE not loaded" , {"OK"} )
ENDIF

IF ! DbeLoad( "CDXDBE",.T.)
   MsgBox( "Database-Engine CDXDBE not loaded" , {"OK"} )
ENDIF

IF ! DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" )
   MsgBox( "FOXCDX Database-Engine;is not created" , {"OK"} )
ENDIF

DbeSetDefault( "FOXCDX" )



DbeInfo( COMPONENT_DATA,  DBFDBE_LOCKRETRY, 1000000          )
DbeInfo( COMPONENT_DATA,  DBFDBE_LOCKDELAY, 10               )
DbeInfo( COMPONENT_DATA,  DBFDBE_LIFETIME,        0          )

DbeInfo( COMPONENT_ORDER, CDXDBE_MODE     , CDXDBE_FOXPRO2X  )
* DbeInfo( COMPONENT_ORDER, CDXDBE_MODE     , CDXDBE_VFOXPRO  )
DbeInfo( COMPONENT_ORDER, CDXDBE_LOCKRETRY, 1000000          )
DbeInfo( COMPONENT_ORDER, CDXDBE_LOCKDELAY, 10               )
DbeInfo( COMPONENT_ORDER, DBE_LOCKMODE    , LOCKING_EXTENDED )


*

* If ( ! DbeLoad( 'DBFDBE', .T.) )
*    MsgBox( 'Databazovy stroj DBFDBE sa nenahral, koncime...', '*** Pozor ***'  )
* EndIf
*
* If ( ! DbeLoad( 'NTXDBE',.T.) )
*    MsgBox( 'Databazovy stroj NTXDBE sa nenahral, koncime...', '*** Pozor ***'  )
* EndIf
*
* If ( ! DbeBuild( 'DBFNTX', 'DBFDBE', 'NTXDBE' ) )
*    MsgBox( 'Databazovy stroj DBF-NTX sa nevytvoril, koncime...', '*** Pozor ***'  )
* EndIf
*
*    DbeSetDefault( "DBFNTX" )



* // default extension DBF->XDB for database files
* DbeInfo( COMPONENT_DATA , DBE_EXTENSION, "XDB" )

* // default extension CDX->XCD for index files
* DbeInfo( COMPONENT_ORDER, DBE_EXTENSION, "XCD" )

RETURN

*


Constants for DbeInfo(COMPONENT_ORDER,CDXDBE_MODE,)
Constant Description
*) ro=READONLY , a=ASSIGNABLE

CDXDBE_VFOXPRO - Visual FoxPro 5.x and higher
CDXDBE_COMIX - Comix for Clipper RDD
CDXDBE_SIX - Six for Clipper RDD
CDXDBE_FOXPRO2X - FoxPro 2.x compatiblity

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: FOXCDX and integer

#7 Post by skiman »

Hi,
try set CDXDBE_MODE for COMPONENT_ORDER to CDXDBE_FOXPRO2X or to CDXDBE_VFOXPRO.
I tried both, but it doesn't make any difference.
Best regards,

Chris.
www.aboservice.be

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: FOXCDX and integer

#8 Post by rdonnay »

You could try indexing on Str(<numfield> ) and then seek the Str() of a number.
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: FOXCDX and integer

#9 Post by skiman »

Hi Roger,

I solved it with an extra index, but I was hoping there would be another solution.

I can't change the other application, and I can't add an extra tag to the CDX file. So my index isn't updated at the moment the DBF changes.

Adding an extra tag isn't possible because this connection will be installed on a lot of customer sites. We can't modify the CDX files. If we change them and there is a problem with the other application, they will say that we are the cause of it.
Best regards,

Chris.
www.aboservice.be

User avatar
PedroAlex
Posts: 230
Joined: Tue Feb 09, 2010 3:06 am

Re: FOXCDX and integer

#10 Post by PedroAlex »

This works fine for me

Code: Select all

//=========================================
Function FOX()

Use ARTIKEL.DBF alias ARTIGOS Shared new
index on A_ARTCODE to ARTORDER
set index to ARTORDER


IF ARTIGOS->( DbSeek( 40010,,1))
	MsgBox(A_BOMSCHRN)
Else
	MsgBox('Not Found')
Endif

IF ARTIGOS->( DbSeek( 40020,,1))
	MsgBox(A_BOMSCHRN)
Else
	MsgBox('Not Found')
Endif

Close ARTIGOS

Return Nil

Pedro
Pedro Alexandre

Post Reply