JasperReports with QCubed
Hi folks. I find myself needing to produce some fairly complex printed reports out of my application. I've searched extensively and find no PHP report writer projects. At least none that seemed to be very robust. All I was able to find was BIRT and JasperReports, but they are both Java based.
Anyway, after testing both of them, I've settled on JasperReports, using iReport as a design layout tool. I was wondering if anyone has experience integrating JasperReports with their QCubed application? If so, I would very much appreciate hearing of your experience and any guidance you have to offer.
Thanks.

I'm familiar with JasperReports (in fact I have integrated it with a j2ee web application). What kind of integration with QCubed are you thinking about? Are you trying to provide a way to run/generate reports on the fly from QCubed through jasperreports? Or simply accessing reports pre-generated by jasperreports?
-Vartan
vakopian, thanks very much for your reply.
At least at first, I'll only be running pre-generated reports, which I'm planning to design, using iReport. As I understand it, I can create the reports using iReport and then use JasperServer to implement them in a runtime environment. However, I haven't yet found any information on how to interface PHP to initiate a report and pass parameters to the report. I'm assuming I can pass parameters to affect the content of the report as well as to configure the database connection. If you have any information or know of some resources on how to do this, I would very much appreciate being pointed in the right direction. I'll have quite a few reports, so I'll likely encapsulate the interface into a QCubed plugin.
Also, have you used iReport as well?
Have you looked at JasperServer already? I have not used it myself, but if I'm not mistaken it actually contains a php sample application. Googling for "JasperServer php" also revealed this page that you might find useful: http://sneakybits.blogspot.com/2008/11/php-client-for-jasperserver-via-s...
Yes I have used iReport as well, for designing the reports. In our application, the design files produced with iReport (jrxml) are uploaded into our web application (which uses the JasperReports library). Then based on the design file we parse and configure all the input parameters, setup the database connection, etc. So at run time the user is presented with a nice UI, where she chooses the values for the params, the format in which to generate the report and runs the report. For us, some additional complications arise for handling subreports, and for managing the lifecycle of database connections/hibernate sessions. But I think these issues should not exist when using JasperServer as a standalone service.
Vartan, thanks again for your guidance and advice. Yes, I have downloaded JasperReports and am going through iReport Ultimate Guide in detail. I'm using the examples included as well as writing some of my own to get comfortable with it in my own database. I do have several reports which will have 3 or 4 sub-reports, each. So, I'm a little worried about that. I do have lots of experience with the old Crystal Reports (including sub-reports) and the concepts of JasperReports are very similar. Since I have zero experience with Java, I'll stick with Groovy or Javascript for expressions. Frankly, after doing a couple of example reports, I think Groovy or Javascript has equal power, without the verbose and restrictive typing requirements of Java.
I've done a lot of Googling on JasperReports and iReport (both with PHP), but the link you found slipped through the cracks. I'll have a look at it and surely bookmark it for reference. Thank you for your effort to find and forward it.
Again, thank you very much for you help. I don't know how many folks will have a need for it, but, when I'm finished with it, I'll write something up and likely provide a plugin. Maybe someone else will be able to make use of it.
LaCeja,
Using java inside the design file with iReport is a PITA for everybody, not just you. So sticking with groovy or javascript is definitely the way. And if you come up with a nice integration with QCubed, I would definitely be interested as I'm currently using QDataGrid with some custom bindings to do a simple report.
Good luck.
It's probably going to take me awhile to get it done, but I'll definitely publish it, when its done. I want to get through two or three complicated reports, so I end up with a robust plugin.
Thanks again.
I found a PHP class, designed to take the jrxml file, generated by Jasper iReport, and create a PDF, interfacing with FPDF. It's aptly called PHPJasperXML. It's a good start, but very short on being a full implementation. For example, doesn't handle multiple detail bands, sub-reports, or a summary page. The good part is, if it gets finished, it doesn't require and java.
Going to take a lot of work to finish it. If anyone's interested in working with me on it, let me know.
Thanks,
LaCeja
LaCeja,
That's interesting. I like fpdf, I've used it before standalone, and it's been great. As of PHPJasperXML, I hope it's not a dead-end: I know how complex the JasperReports implementation is, and PHPJasperXML would basically have to re-implement the whole library to provide the same functionality.
If it was me, I would still consider using the JasperServer and making the php app talk to it. The other advantage that you can get with JasperServer is that it supports many more output formats, not just pdf (xls, html and xml are especially useful).
But I understand not everybody can run a java server on their hosting servers.
-Vartan
Vartan:
My primary objective was to avoid having to run a Tomcat server. However, I'm discovering the task of extending the existing PHPJasperXML is probably not going to be practical. If all reports were simple tabular reports, it be a good project. However, I've got lots of reports with sub-reports and other complex issues. Anyway, I think it will be much more practical to use Tomcat and make PHP communicate with JasperServer through PHPJavaBridge. Even the long term benefits of having a fully functional PHPJasperXML do not outweigh the cost.