Tutorial for JasperReports, iReport, and JFreeChart
Be the 1st to comment!

This tutorial discusses building JasperReports in iReport using charts with JFreeChart.

Building Dynamic JasperReports
Be the 1st to comment!

If your reporting needs require more dynamic reports, with user control over the elements to be included in the report, developerWorks has an article on Generating XML templates for JasperReports using Rational Application Developer.

JasperReports helps organizations generate affordable business data reports using an XML template. The XML template provides the key report information such as the SQL query, report title, column headers, and database fields. This article discusses how to generate the XML template to allow a user to specify which report columns should be included.

Highlighting Odd and Even Rows in JasperReports
Be the 1st to comment!

In order to highlight odd or even rows with a background color, in JasperReports, first create a rectangle element with a background of your color choice, and send it to the background (in JasperAssistant, right click on the rectangle, choose Arrange and then Send to Back). Second, use the following expression to set when the element should appear, by placing the expression in the Print When Expression field of the rectangle element. Where the $V{PAGE_COUNT} appears, you can use that, to base it on the row number on the page, or use $V{REPORT_COUNT} to base it on the row within the report. Also, if you are using a group, you can use $V{groupname_COUNT} where groupname is replaced with the name of your group. The expression below will then test the row number within the Page, Report, or Group (whichever you selected) and if its divisible by 2, it will display the rectangle element with the background color.

new Boolean( $V{PAGE_COUNT}.intValue() % 2 ==0 )
JasperReports and OpenReports

The most recent project I have been working on involved creating a large number of reports for the company’s extranet/intranet. In the past, I have usually done reports using some form of JSP and JDBC. But in this case, there is a large number of reports to be developed, and so I was tasked with researching some of the open source solutions for reporting, in hopes we could find a solution that would allow us to get the reports done faster, and be provided to the user with more functionality, and with less custom code.

In the end we compared Crystal reports with JasperReports, and JasperReports was picked. JasperReports is not only free, but also is proven in the Java world, and has a lot of users. It is customizable, since its Java and open source, and has support for using Collections or Lists of Business Objects, such as those populated via Hibernate.

Read More »