Kbase P116200: How to open and refresh the data of a Crystal Reports report object originally designed against two
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/03/2009 |
|
Status: Verified
GOAL:
How to open and refresh the data of a Crystal Reports report object originally designed against two ODBC data sources using 4GL?
FACT(s) (Environment):
Windows
Progress 9.x
OpenEdge 10.x
Crystal Reports 10
Crystal Reports 11 (XI)
OpenEdge Category: Language (4GL/ABL)
FIX:
The following 4GL code demonstrates how to open a Crystal Reports Report object originally designed against two data sources. Please note that the code refreshes the data in the report and populates the data from the original data sources each time the code is executed:
DEFINE VARIABLE chApplication AS COM-HANDLE NO-UNDO.
DEFINE VARIABLE chReport AS COM-HANDLE NO-UNDO.
CREATE 'CrystalRuntime.Application' chApplication.
CREATE 'CrystalRuntime.Report' chReport.
/* Enter details of your ODBC connections here */
chApplication:LogOnServer("CRDB_ODBC.DLL", "FirstDataSourceName", "", "FirstID", "FirstPassword").
chApplication:LogOnServer("CRDB_ODBC.DLL", "SecondDataSourceName", "", "SecondID", "SecondPassword").
/* Insert full path to the Crystal report */
chReport = chApplication:OpenReport("C:\WRK91E\MultiDatabase.rpt").
/* Discard the data saved previously with the report */
chReport:DiscardSavedData().
/* Reload fresh data from the original data sources. */
chCtrlFrame:CrystalActiveXReportViewer:REFRESH().
/* Enables the CRViewer's Navigation Controls */
chCtrlFrame:CrystalActiveXReportViewer:EnableNavigationControls = TRUE.
/* Enables the CRViewer's Group Tree */
chCtrlFrame:CrystalActiveXReportViewer:DisplayGroupTree = FALSE.
/* Enables the CRViewer's Export button */
chCtrlFrame:CrystalActiveXReportViewer:EnableExportButton = TRUE.
/* Disables the CRViewer's Search control */
chCtrlFrame:CrystalActiveXReportViewer:EnableSearchControl = FALSE.
/* Set the report source */
chCtrlFrame:CrystalActiveXReportViewer:ReportSource = chReport.
/* View the report */
chCtrlFrame:CrystalActiveXReportViewer:ViewReport().
RELEASE OBJECT chApplication.
RELEASE OBJECT chReport.