I am trying to use the activex Crystal Reports Viewer (Crystal Reports version 10) to display a report in our application. To do this I am producing an xml file containing the report data (created from a dataset), saving this to disk, and then running the report using this xml file as the datasource. When I first run the report in my application the report works and display the correct data, but if I then change any of the report criteria to change the data that should be displayed in the report the report that gets displayed to screen has not refreshed the data, and is just identical to the first report I displayed. If I close the application and restart it the report again works the first time I run it - though this could be a bit of a red herring as the filename of the xml data file will be different. Any ideas what I am missing. The code I use is below, and this is in a screen that has the Crystal Report activex Viewer for version 10 Crystal Reports attached to it.
gch-CrystalViewer = chcf-crystal:CrystalActiveXReportViewer.
DO ON ERROR UNDO, RETURN ERROR:
IF v-ConstructCrystalDone THEN
RETURN.
CREATE "CrystalRuntime.Application" gchApplication NO-ERROR.
IF ERROR-STATUS:ERROR THEN
do:
run sm-message in this-procedure ("ERROR":u,0,
"Crystal Reports Configuration/Installation error",
"").
run close-down in this-procedure.
end.
v-ConstructCrystalDone = YES.
END.
ch-Report = gchApplication:OpenReport(p-template,1).
do v-count = 1 to ch-Report:database:Tables:count:
ch-Reportatabase:Tables:item(v-count):setTableLocation(p-xmlfilename, '', '').
end.
ch-ReportiscardSavedData().
gch-CrystalViewer:ReportSource = ch-Report.
gch-CrystalViewer:refresh.
gch-CrystalViewer:ViewReport.
Thanks,
Andrew.
gch-CrystalViewer = chcf-crystal:CrystalActiveXReportViewer.
DO ON ERROR UNDO, RETURN ERROR:
IF v-ConstructCrystalDone THEN
RETURN.
CREATE "CrystalRuntime.Application" gchApplication NO-ERROR.
IF ERROR-STATUS:ERROR THEN
do:
run sm-message in this-procedure ("ERROR":u,0,
"Crystal Reports Configuration/Installation error",
"").
run close-down in this-procedure.
end.
v-ConstructCrystalDone = YES.
END.
ch-Report = gchApplication:OpenReport(p-template,1).
do v-count = 1 to ch-Report:database:Tables:count:
ch-Reportatabase:Tables:item(v-count):setTableLocation(p-xmlfilename, '', '').
end.
ch-ReportiscardSavedData().
gch-CrystalViewer:ReportSource = ch-Report.
gch-CrystalViewer:refresh.
gch-CrystalViewer:ViewReport.
Thanks,
Andrew.