CDX Index File errors.
-
- Posts: 32
- Joined: Fri Jan 20, 2012 9:24 am
CDX Index File errors.
I have a problem when a .CDX is created in the following example. The index key is 140 characters with the field “Collection” included. xBase++ does not like this length and errors when the index is opened. It I remove “Collection”. The key index length is 85 and the program does not error. The docs state the “Max length for both INDEX plus FOR expression is 512 characters”. What am I doing wrong?
Thanks for your time.
Doug
PROCEDURE MAIN
LOCAL mDBPath := ""
LOCAL mDBIndex := "TESTCDX"
LOCAL mCdbKeyC := 'RunCode + EndPeriod + StrPeriod + Sequence + ' +;
' EndYrWk + StrYrWk + Type + Plant + PMSType + SysTyGrIt + Collection'
LOCAL mBdbKeyC := {|| RunCode + EndPeriod + StrPeriod + FIELD->Sequence +;
EndYrWk + StrYrWk + Type + Plant + PMSType + SysTyGrIt + FIELD->Collection}
DBCREATE("TESTCDX",{;
{"RunCode","C", 5, 0},;
{"EndPeriod","C", 4, 0},;
{"StrPeriod","C", 4, 0},;
{"EndYrWk","C", 4, 0},;
{"StrYrWk","C", 4, 0},;
{"Sequence","C", 2, 0},;
{"RPTSEQ","C", 8, 0},;
{"Type","C", 1, 0},;
{"Plant","C", 4, 0},;
{"A","C", 17, 0},;
{"PMSType","C", 2, 0},;
{"SysTyGrIt","C",55, 0},;
{"Collection","C",55, 0};
})
USE TESTCDX NEW EXCLUSIVE VIA "DBFCDX"
* Create The Indexes
@24,0 SAY PADC("Creating PMS Customer Data Code Order Indexes",80)
* ALTD()
* the following errors with a "Length of database field exceeded" when
* typed at the debugger command line
ORDCREATE("TESTCDX", "CUSTOMER_O", mcdbkeyC, mbdbkeyC)
SET INDEX TO
* This errors with a "file cannot be opened"
SET INDEX TO ("TESTCDX")
RETURN
Thanks for your time.
Doug
PROCEDURE MAIN
LOCAL mDBPath := ""
LOCAL mDBIndex := "TESTCDX"
LOCAL mCdbKeyC := 'RunCode + EndPeriod + StrPeriod + Sequence + ' +;
' EndYrWk + StrYrWk + Type + Plant + PMSType + SysTyGrIt + Collection'
LOCAL mBdbKeyC := {|| RunCode + EndPeriod + StrPeriod + FIELD->Sequence +;
EndYrWk + StrYrWk + Type + Plant + PMSType + SysTyGrIt + FIELD->Collection}
DBCREATE("TESTCDX",{;
{"RunCode","C", 5, 0},;
{"EndPeriod","C", 4, 0},;
{"StrPeriod","C", 4, 0},;
{"EndYrWk","C", 4, 0},;
{"StrYrWk","C", 4, 0},;
{"Sequence","C", 2, 0},;
{"RPTSEQ","C", 8, 0},;
{"Type","C", 1, 0},;
{"Plant","C", 4, 0},;
{"A","C", 17, 0},;
{"PMSType","C", 2, 0},;
{"SysTyGrIt","C",55, 0},;
{"Collection","C",55, 0};
})
USE TESTCDX NEW EXCLUSIVE VIA "DBFCDX"
* Create The Indexes
@24,0 SAY PADC("Creating PMS Customer Data Code Order Indexes",80)
* ALTD()
* the following errors with a "Length of database field exceeded" when
* typed at the debugger command line
ORDCREATE("TESTCDX", "CUSTOMER_O", mcdbkeyC, mbdbkeyC)
SET INDEX TO
* This errors with a "file cannot be opened"
SET INDEX TO ("TESTCDX")
RETURN
Re: CDX Index File errors.
Doug -
I suggest adding FIELD-> to the front of each field name in the index and see if it helps.
Roger
I suggest adding FIELD-> to the front of each field name in the index and see if it helps.
Roger
The eXpress train is coming - and it has more cars.
Re: CDX Index File errors.
dont know where you got these wrpng Information, see PDR 5694dougtanner wrote:I have a problem when a .CDX is created in the following example. The index key is 140 characters with the field “Collection” included. xBase++ does not like this length and errors when the index is opened. It I remove “Collection”. The key index length is 85 and the program does not error. The docs state the “Max length for both INDEX plus FOR expression is 512 characters”. What am I doing wrong?
For fields of type character the maximum length of the index value
is 120 characters. When the CDXDBE runs is in FOXPRO2X or COMIX mode
then the maximum length of the key value is 240. This is not documented.
greetings by OHR
Jimmy
Jimmy
-
- Posts: 32
- Joined: Fri Jan 20, 2012 9:24 am
Re: CDX Index File errors.
Thanks for you help. Alaska support agrees that the documentation is misleading (Translation "It's Wrong") and recommends limited the length of the key for CDXs to 100 characters. Without much effort, I can rewrite the code. I would prefer not to go with COMIX or FOXPRO2. (Alaska said, and I verified that my example would not run in FOXPRO).
Doug
Doug
Re: CDX Index File errors.
Doug -
What is your reason for not liking COMIX?
I used this format in all of my Clipper apps.
Roger
What is your reason for not liking COMIX?
I used this format in all of my Clipper apps.
Roger
The eXpress train is coming - and it has more cars.
-
- Posts: 32
- Joined: Fri Jan 20, 2012 9:24 am
Re: CDX Index File errors.
Hi Roger,
" What is your reason for not liking COMIX?"
Fear of the unknown and I couldn't get it to work. I tried adding:
DbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_FOXPRO2X )
and it still didn't work. How can I enable COMIX?
Doug
" What is your reason for not liking COMIX?"
Fear of the unknown and I couldn't get it to work. I tried adding:
DbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_FOXPRO2X )
and it still didn't work. How can I enable COMIX?
Doug
Re: CDX Index File errors.
DbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_COMIX )
The eXpress train is coming - and it has more cars.
-
- Posts: 32
- Joined: Fri Jan 20, 2012 9:24 am
Re: CDX Index File errors.
Hi Roger,
I added "COMIX" to my DBESYS. Changed my program to the following. It errors when the key length gets to 121.
What am I doing wrong?
Doug
PROCEDURE MAIN
LOCAL mDBPath := ""
LOCAL mDBIndex := "TESTCDX"
LOCAL cDBKeyC := "KeyField"
LOCAL bDBKeyC := {|| FIELD->KeyField}
FOR mLen := 1 TO 140
IF FILE("TESTCDX.DBF")
FERASE("TESTCDX.DBF")
ENDIF
IF FILE("TESTCDX.CDX")
FERASE("TESTCDX.CDX")
ENDIF
? mlen
DBCREATE("TESTCDX",{;
{"KeyField","C", mLen, 0}})
USE TESTCDX NEW EXCLUSIVE VIA "DBFCDX"
ORDCREATE("TESTCDX", "TESTING", cdbkeyC, bdbkeyC)
SET INDEX TO
* This errors with a "file cannot be opened" when length = 121
SET INDEX TO ("TESTCDX")
CLOSE ALL
NEXT
RETURN
I added "COMIX" to my DBESYS. Changed my program to the following. It errors when the key length gets to 121.
What am I doing wrong?
Doug
PROCEDURE MAIN
LOCAL mDBPath := ""
LOCAL mDBIndex := "TESTCDX"
LOCAL cDBKeyC := "KeyField"
LOCAL bDBKeyC := {|| FIELD->KeyField}
FOR mLen := 1 TO 140
IF FILE("TESTCDX.DBF")
FERASE("TESTCDX.DBF")
ENDIF
IF FILE("TESTCDX.CDX")
FERASE("TESTCDX.CDX")
ENDIF
? mlen
DBCREATE("TESTCDX",{;
{"KeyField","C", mLen, 0}})
USE TESTCDX NEW EXCLUSIVE VIA "DBFCDX"
ORDCREATE("TESTCDX", "TESTING", cdbkeyC, bdbkeyC)
SET INDEX TO
* This errors with a "file cannot be opened" when length = 121
SET INDEX TO ("TESTCDX")
CLOSE ALL
NEXT
RETURN
Re: CDX Index File errors.
"where" is you DBESYS ? did you compile and link it after modification ?dougtanner wrote:I added "COMIX" to my DBESYS. Changed my program to the following. It errors when the key length gets to 121.
What am I doing wrong?
if you do not use a *.XPJ you have to modify your "Main" this Way
Code: Select all
PROCEDURE dbeSys()
// NTX
IF !DbeLoad( "DBFDBE", .T. )
ALERT( MSG_DBFDBE_NOT_LOADED, { "OK" } )
ENDIF
IF !DbeLoad( "NTXDBE", .T. )
ALERT( MSG_NTXDBE_NOT_LOADED, { "OK" } )
ENDIF
IF !DbeBuild( "DBFNTX", "DBFDBE", "NTXDBE" )
ALERT( MSG_DBFNTX_NOT_CREATED, { "OK" } )
ENDIF
// CDX
IF !DbeLoad( "CDXDBE", .T. )
ALERT( MSG_CDXDBE_NOT_LOADED", { "OK" } )
ENDIF
IF !DbeLoad( "FOXDBE", .T. )
ALERT( MSG_FOXDBE_NOT_LOADED, { "OK" } )
ENDIF
IF !DbeBuild( "FOXCDX", "FOXDBE", "CDXDBE" )
ALERT( MSG_FOXCDX_NOT_CREATED, { "OK" } )
ENDIF
//
// Cl*pper Comix/SixDrive using FOXDBE (DATA-Komponente)
//
DbeInfo( COMPONENT_DATA, FOXDBE_CREATE_2X, .T. )
//
// if used together with Cl*pper
//
DbeInfo( COMPONENT_DATA, FOXDBE_LOCKMODE, FOXDBE_LOCKMODE_CLIPPER )
//
// Cl*pper Comix using CDXDBE (ORDER Komponente)
//
DbeInfo( COMPONENT_ORDER, CDXDBE_MODE, CDXDBE_COMIX )
// default set to CDX
DbeSetDefault( "FOXCDX" )
RETURN
PROCEDURE MAIN
*** if you use more than 1 DBE be sure to use "right" DBE ( here DBENTX and FOXCDX )
Code: Select all
DbCreate( "TESTCDX",{{"KeyField","C", mLen, 0}}, "FOXCDX" )
greetings by OHR
Jimmy
Jimmy
-
- Posts: 32
- Joined: Fri Jan 20, 2012 9:24 am
Re: CDX Index File errors.
Thanks, Auge_Ohr
Those changes to my dbesys() worked. You and Roger are the best!
Doug
Those changes to my dbesys() worked. You and Roger are the best!
Doug