//Variable declaration myReport Report; myReportData ReportData; //Function containing report invocation code function makeReport() //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 connection sysLib.defineDatabaseAlias("alias", "connectionName"); sysLib.connect("alias", "userid", "password"); myReportData.connectionName = "alias"; myReport.reportData = myReportData; //Fill the report with data reportLib.fillReport(myReport, DataSource.databaseConnection); //Export the report in PDF format myReport.reportExportFile = "c:\\temp\\reportDesignFileName.pdf"; reportLib.exportReport(myReport, ExportFormat.pdf); end
Record myRecord type BasicRecord author String; description String; title String; end
//Variable declarations myReport Report; myReportData ReportData; recArray myRecord[]; recArrayElement myRecord; //Function containing the report driving code function makeReport() //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 populateReportData(); myReport.reportData = myReportData; //Fill the report with data reportLib.fillReport(myReport, DataSource.reportData); //Export the report in HTML format myReport.reportExportFile = "c:\\temp\\myReport.html"; reportLib.exportReport(myReport, ExportFormat.html); end function populateReportData() recArrayElement.author="Jane Austen"; recArrayElement.title="Northanger Abbey"; recArrayElement.description = "British Novel"; recArray.appendElement(recArrayElement); recArrayElement.author = "Jane Austen"; recArrayElement.title="Emma"; recArrayElement.description = "British Novel"; recArray.appendElement(recArrayElement); recArrayElement.author = "Charles Dickens"; recArrayElement.title="Our Mutual Friend"; recArrayElement.description = "British Novel"; recArray.appendElement(recArrayElement); recArrayElement.author = "Gustave Flaubert"; recArrayElement.title="Madame Bovary"; recArrayElement.description = "French Novel"; recArray.appendElement(recArrayElement); recArrayElement.author = "M. Lermontov"; recArrayElement.title="Hero of Our Time"; recArrayElement.description = "Russian Novel"; recArray.appendElement(recArrayElement); end
//Variable declaration myReport Report; myReportData ReportData; //Function containing report driving code function makeReport() //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 SQL statement myReportData.sqlStatement = "SELECT * FROM dataBaseTable"; myReport.reportData = myReportData; //Fill the report with data reportLib.fillReport(myReport, DataSource.sqlStatement); //Export the report in text format myReport.reportExportFile = "c:\\temp\\myReport.txt"; reportLib.exportReport(myReport, ExportFormat.text); end
Related concepts
EGL report creation process overview
EGL reports overview
Related tasks
Writing code to drive a report
Related reference
Report and ReportData parts
EGL report handler
EGL library ReportLib