xsharp.eu • Cannot Open SomeIndex.CDX when starting ReportPro 2.17 - Page 2
Page 2 of 3

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sat Apr 27, 2019 9:37 am
by lumberjack
Hi Jeff,
BiggyRat wrote:it now says it can't find Client.CDX or Details.cdx, though BOTH are in the same folder as the report. Any ideas please?
I have never used ReportPro in "designer" mode, only for hardnoded reports. I see your .RPT contains "C:CAVO28Bin<filename>.DBF / .CDX
Are you sure that is where the .DBF/CDX files are located?

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sat Apr 27, 2019 9:49 am
by BiggyRat
Yes Johan, absolutely positive...

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 1:57 am
by BiggyRat
Here is my index re-indexing code. Is there anything in here that's wrong perhaps? I've left all my previous attempts visible to show my working out...

METHOD OptionsReindex CLASS MainMenu

LOCAL oServer as DBServer

RddSetDefault("DBFCDX")
self:Pointer := Pointer{ POINTERHOURGLASS }

SetExclusive( true )

oServer := DbServer{"Client"}
oServer:PACK()
oServer:GoTop()
/* oServer:CreateOrder("CLCode", "Client","CLCode",,.T.)
oServer:CreateOrder("CLName", "Client", "ClName")
oServer:CreateOrder("ClState", "Client", "ClState")
oServer:CreateOrder("CLCodeName", "Client", "AllTrim(CLIENT->ClCode) + Space(1) + Alltrim(CLIENT->ClName)" )
oServer:CreateOrder("CLPcode", "Client", "ClPCode") */
oServer:Reindex()

DbSetIndex("client")
?? DbReindex() <====== returns true


oServer:CLOSE()

oServer := DbServer{"Details"}
oServer:PACK()
oServer:GoTop()
/* oServer:CreateOrder("CLCode", "Details", "CLCode")
oServer:CreateOrder("CLCodeName", "Details", "AllTrim(DETAILS->CLCODE) + Space(1) + AllTrim(DETAILS->CLNAME)" )
oServer:CreateOrder("JobDate", "Details", "JobDate")
oServer:CreateOrder("JobFin", "Details", "JobFin")
oServer:CreateOrder("JobNumber", "Details", "JobNumber")
oServer:CreateOrder("PONumber", "Details", "PONumber",, .T.)
oServer:CreateOrder("Subby", "Details", "Subby",, .T.)
oServer:CreateOrder("Rego", "Details", "Rego")
oServer:CreateOrder("Invoiced", "Details", "Invoiced")
oServer:CreateOrder("InvFile", "Details", "InvFile") */
oServer:Reindex()
DbSetIndex("Details")
?? DbReindex() <======= returns true
oServer:CLOSE()

SetExclusive(FALSE)
self:Pointer := Pointer{ POINTERARROW }
self:Show()

return self

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 2:21 am
by BiggyRat
OK I worked it out. These two lines are causing it, but WHY?

oServer:CreateOrder("CLCodeName", "Client", "AllTrim(CLIENT->ClCode) + Space(1) + Alltrim(CLIENT->ClName)" )

AND

oServer:CreateOrder("CLCodeName", "Details", "AllTrim(DETAILS->CLCODE) + Space(1) + AllTrim(DETAILS->CLNAME)" )


As expressions they test OK, QQout say they create ok, yet it is these two lines (one in each index of course) stopping the report from opening. What have I done wrong please?

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 4:11 am
by lumberjack
Hi Jeff,
BiggyRat wrote:OK I worked it out. These two lines are causing it, but WHY?
oServer:CreateOrder("CLCodeName", "Client", "AllTrim(CLIENT->ClCode) + Space(1) + Alltrim(CLIENT->ClName)" )
AND
oServer:CreateOrder("CLCodeName", "Details", "AllTrim(DETAILS->CLCODE) + Space(1) + AllTrim(DETAILS->CLNAME)" )
As expressions they test OK, QQout say they create ok, yet it is these two lines (one in each index of course) stopping the report from opening. What have I done wrong please?
Think you just need to drop the "CLIENT->" and "DETAILS->" from your expressions. Rather use "FIELD->" or "_FIELD->", sorry have not done DBF in ages so you need to check those two out.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 4:35 am
by BiggyRat
Hmmm OK, thank you very much Johan.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 5:21 am
by lumberjack
BiggyRat wrote:Hmmm OK, thank you very much Johan.
Hi Jeff,
Further to my previous response, remember you cannot guarantee that your DBF will always be referenced/aliased as "Client", your index expressions are hard-coded to a specific alias. Let us know if that solves the issue.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 6:09 am
by robert
Johan,
You are right.
ReportPro opens the workareas with aliases that look like _RP1, _RP2 etc.

Robert

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 8:08 am
by BiggyRat
OK, thank you Robert and Johan,that was something I wasn't aware of with the Aliases in ReportPro. I will certainly keep that in mind. In the meantime, yes, your solution Johan seems to have done the trick. The report now opens every time without error. Thanks again.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sun Apr 28, 2019 12:27 pm
by wriedmann
Hi Jeff,

AFAIK CDX indices cannot have variable length expressions. If you are using AllTrim(), you need to pad them to a fixed lenght.

Wolfgang