I have a crystal report in Xi which uses an XML file as a data source. I have code from the ABL which produces the XML file from Progress, calls the Crystal Report with the new xml file as a data source and it opens fine and everything works great. I have now introduced a sub report to the main report and this is based on a different XML file. However, now when I call the report I cannot get the sub report to take account of the data in the newly created XML file, it always uses the data in the original data source not the new one I am passing in. A code snippet is shown below:
chReport = gchApplication:OpenReport(vFullRpt,1).
chReport:Database:Tables:item(1):setTableLocation(ipXMLfile1,'','') no-error.
IF error-status:error THEN
DO:
assign vMessage = "Error in setTableLocation: " + ipXMLFile1.
MESSAGE vMessage
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
chReportSub = gchApplication:OpenReport(vSubRpt,1).
chReportSub:Database:Tables:item(1):setTableLocation(ipXMLfile2,'','') no-error.
IF error-status:error THEN
DO:
assign vMessage = "Error in setTableLocation: " + ipXMLFile2.
MESSAGE vMessage
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
chReport:DiscardSavedData() no-error.
chReportSub:DiscardSavedData() no-error.
Using this, the full report opens correctly showing the data contained in ipXMLfile1 but the sub report (vSubRpt) does not contain the data in ipXMLFile2.
I have also tried:
chReport:Database:Tables:item(2):setTableLocation(ipXMLfile2,'','') no-error.
But no joy on that either.
Any ideas!!!!!!
Thanks
Colin