I use Jasper for reporting along with a wrapper someone posted a while back to create a JRDataSource from EOGenericRecords.

It was called WCJRDataSource...I can't find it again on the web so it's attached.

Then I run the report with something like this:



        public static JasperReport getCompiledReport(String reportName) {
                try {
InputStream reportDef = getResource("Reports/" + reportName + ".jrxml");
                        try {
                                return 
JasperCompileManager.compileReport(reportDef);
                        } catch (Exception ex) {
System.err.println("Failed to compile report " + reportName + ": " + ex.getMessage());
                        }
                        
                } catch (Exception ex) {
System.err.println("Failed to find report file for " + reportName + ": " + ex.getMessage());
                }
                return null;
                
        }
        
public static byte[] runReportToPDF(String reportName, Map parameters, WCJRDataSource dataSource) {
                JasperReport compiledReport = getCompiledReport(reportName);
                try {
return JasperRunManager.runReportToPdf(compiledReport, parameters, dataSource);
                } catch (Exception ex) {
System.err.println("Failed to run report " + reportName + ": " + ex.getMessage());
                }
                return null;
        }


Works great for us.

HTH,

John

Attachment: WCJRDataSource.java
Description: Binary data





On Sep 4, 2009, at 10:32 AM, Kieran Kelleher wrote:

Hi All,

What are the latest recommendations for Free Open Source reporting libraries to integrate with a WebObjects app?

and also, what are opinions of these two:
        BIRT:  http://eclipse.org/birt/phoenix/
        Jasper Reports: http://jasperforge.org/projects/jasperreports

Regards, Kieran
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/jours%40mac.com

This email sent to jo...@mac.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to