Use the New EGL Part wizard to create a new EGL basic program that uses the report library to run reports.
Code showing report-invocation information
myReport Report; myReportData ReportData; //Initialize Report file locations myReport.reportDesignFile = "c:\\workspace\\report_project\\bin\\report_package\\myReport.jasper"; myReport.reportDestinationFile = "c:\\temp\\myReport.jrprint"; //Get the report data via a SQL statement myReportData.sqlStatement = "Select * From myTable"; myReport.reportData = myReportData; //Fill the report with data ReportLib.fillReport(myReport, DataSource.sqlStatement); //Export the report in pdf myReport.reportExportFile = "c:\\temp\\myReport.pdf"; ReportLib.exportReport(myReport, ExportFormat.pdf);Because the backslash character ("\") is used in escape sequences, you must use a double backslash in path names.
Code | Explanation |
---|---|
myReport Report; | A report library record declaration |
myReportData ReportData; | A report library data record declaration |
myReport.reportDesignFile = "c:\\workspace\\..." | Full path to the .jasper design file |
myReport.reportDestinationFile ="c:\\temp\\myReport.jrprint"; | Full path to the intermediate (destination) work file |
myReport.sqlStatement = "Select * From myTable"; | The SQL statement used to provide data to the report |
myReport.reportData = myReportData; | Assigns the data the variable of type Report |
ReportLib.fillReport(myReport, DataSource.sqlStatement ); | Defines the data source for the report to be an SQL statement |
myReport.reportExportFile = "c:\\temp\\myReport.pdf | Full path to the file to be created/used for PDF output |
ReportLib.exportReport(myReport, ExportFormat.pdf); | Specifies the report export format |
Related concepts
EGL reports overview
EGL report creation process overview
Related tasks
Creating an EGL report handler
Creating the report design file
Using report templates
Related reference
EGL report handler
EGL library ReportLib
Sample code for EGL report-driver functions