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

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Tue Apr 16, 2019 4:52 am
by Anonymous
Hi. I'm having a problem with SOME reports created in ReportPro 2.17. SOME start with an error saying cannot find "whatever.cdx" despite the fact that there is no possible way that index can be open anywhere else. Any clues at all please? If I click OK, the error goes away and thew report works fine...



Jeff

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Tue Apr 16, 2019 5:12 am
by wriedmann
Hi Jeff,

are you using the Vulcan runtime or the X# runtime?

Wolfgang

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Tue Apr 16, 2019 7:41 am
by BiggyRat
VO runtime.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Tue Apr 16, 2019 7:53 am
by FFF
Jeff,
you write the error is "cannot find" - so it shouldn't matter, whether the cdx is already in use.

Maybe it's related with my open ticket from last year <g>:
Doubleclicking a rpt, it opens the designer, but if the datapath in such a rpt is not correct (e.g. accessing on another machine), RP2 complains and let you select the data.dbf, but immediately complains again about missing cdx, because it looks for the cdx in the old folderpath, instead of the new one - and there's no possibility to select the path for the index.
Karl

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Wed Apr 17, 2019 1:22 am
by Jamal
One cause: If your CDX key expression contains user defined functions, RP does NOT know about them and thus the error.
However, just ignore it.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Wed Apr 17, 2019 7:16 am
by BiggyRat
Hi Karl and Jamal, I'm not OVERLY concerned by it, but I'm worried the end users will be...


Jeff

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Wed Apr 17, 2019 7:37 am
by Jamal
Well, should we assume you did not write any code to open the report yet?

If not, see oReport:SetReportStringAttribute( ) in the RP docs. This is from RP 3, but it should be the same in RP 2.x if I recall. It has attribute values for dbf path, index driver, table, index file, tag, work_area. If you set those properly, the report will open fine.

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Fri Apr 19, 2019 6:20 am
by BiggyRat
Well as usual I've looked everywhere for SetReportStringAttribute but it doesn't appear to be in v2.x even Google searches return only results for RP 3.x

Any other ideas anyone?

This is an example that I'm trying at the moment:

METHOD PushButton10( ) CLASS MainMenu
Local oReport as RpReport
LOCAL aDBS[0] as ARRAY
Local CsTR as string
AAdd(aDBS,{"details.dbf","Job Details Table","DBFCDX",FALSE})
AAdd(aDBS,{"client.dbf","Client Table","DBFCDX",FALSE})
CsTR := WorkDir() + "BMInvoice.rpt"
oReport := RpReport{self, aDBS}
oReport:LoadRpt("BMInvoice.RPT")
RETURN nil

That's the entire thing. I just want to open my RPT file in the Designer, but it won't get past the "Cannot Open Client.CDX" Attsached is the actual report causing me the grief. The whole idea is, this Report - BMInvoice is going to be used as a template so the end user can modify their invoice to suit themselves (in much the same way as MYOB does)

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Fri Apr 19, 2019 6:50 am
by robert
Jeff,
Your report uses:
- C:CAVO28BINDETAILS.DBF with Alias Details
- DETAILS.CDX (note no path specified, so should be opened in the same folder as the DBF
- C:CAVO28BINCLIENT.DBF with alias Client
- C:CAVO28BINCLIENT.CDX
The relation between the two tables is Client.Clcode = Details.Clcode
To override the file names at runtime simply copy all the files to one folder and pass that foldername in the cDataPath parameter or pass the aDBFSwap array and specify details per file:

Code: Select all

oReport := RpReport{oOwner, cFilename, [cDatapath], [aDbfSwap]}
aDbfSwap Allows you to swap out the tables used in the report. While this parameter applies primarily to RDD tables, it can also be used to substitute tables in a SQL query.
Any value of the array that you do not wish to change should be specified as NIL. If you specify NULL_STRING, the value will be changed to the empty string value.
The format of the array is:

{{RPAlias, Table File, Index File, Index Tag, RDD, RDDAlias}, {...}, ...}

RPAlias The alias which ReportPro has assigned to the table. This character value can be found in the Setup Sections dialog. This is the key used to designate which table in the data set is being replaced so it must exactly match the ReportPro alias.

Table File The complete path and file name of the substituted table.
Index File The index file to use in place of the index filename specified in the Setup Sections dialog.
Index Tag The index tag used in conjunction with the Index File specified above. If the Index File is specified, you must specify a Tag for DBFCDX and DBFMDX RDDs.
RDD The RDD to use with this table.
RDDAlias When specified, this element forces ReportPro to use an already open DBF table instead of opening the one specified in the report. This element can be the alias name, the work area number or the DBServer of the already open table.

In your case the RpAlias is "Details" for the first table and "Client " for the second table.

Robert

Cannot Open SomeIndex.CDX when starting ReportPro 2.17

Posted: Sat Apr 27, 2019 9:01 am
by BiggyRat
Thanks Robert, that was VERY informative, and clarified A LOT. Thanks very much. However, I'm now getting several different areas. In RP 2.30a creating the Report, it now says it can't find Client.CDX or Details.cdx, though BOTH are in the same folder as the report. Also, when trying to set the Order, I get a message saying "The Index file is not valid for this table" the index file is ALSO in the same folder as the report and the database. I've attached the latest version of the report.

Any ideas please?