My entire carrier is linked to Java. I have been working in Java for 15 years and I still love it. I currently develop NextReports application

My Personal Blog
My NextReports Blog
NextReports Site
Mihai has posted 33 posts at DZone. You can read more from them at their website. View Full User Profile

How Do You Make Your Reports?

04.12.2011
| 7999 views |
  • submit to reddit
Almost all business applications need to have some reports to create statistics, goals or any kind of information needed for analysis. There are many tools and report engines used by developers or non-developers (like Jasper, BIRT, Crystal). Some are free, some are commercial. Some are BI tools, some are simpler.  Many people are complaining about existing solutions and they started to implement some for scratch to fulfill their needs. And that’s the way a reporting tool may start.

NextReports was in inception three years ago. Developers in our company used to create reports with Jasper. But many problems were making their lives harder. 80% of reports were not very complicated, but needed changes at a very short pace. Adding components and rearrange columns was time consuming. Reports were created by business analysts without Java knowledge, but they needed to know some Java classes for parameters definitions. Reports needed a compilation step before running, so in all of our server instances we needed to set in PATH variable the path to the java bin location.

All these things were factors which brought NextReports to life. First a simple report designer was created in Swing making use of all good libraries for desktop applications like Swingx, JGoodies, MyDoggy, JXLayer, JFreeChart.

NextReports Designer is a free and very simple ad hoc query and reporting tool. You can create your queries just with drag-and-drops or you can delve inside the query editor and write complicated queries or call stored procedures.

Query Designer

NextReports Designer can connect to popular databases, like Oracle, MySQL, SQL Server, PostgreSQL, Derby, Firebird.

With a query, you can create reports and charts. Report Layout is a simple grid structure like an excel sheet. You just edit your cells with text, parameters, variables, database columns, expressions, functions, hyperlinks. You can create groups and you set all your visual properties like colors, fonts, borders, patterns and many others. Reports can be exported to many formats like HTML, PDF, RTF, EXCEL, CSV, TSV, TXT, and XML. iText and poi libraries were used for pdf, rtf and excel exporters.

Report Layout

Chart Layout gives you the possibility to generate charts as flash using Open Flash Chart library or as image using JFreeChart library. In this way a chart can be added to dashboards for live visualization or can be inserted inside a report (where an image will be needed).

Chart Layout

Queries, reports and charts are saved as xml files using xstream library. With NextReports Designer you can do more than creating these entities like imports / exports of data sources, simple templates creation, backup & restore of all your workspace, publish your reports and charts to a NextReports server.

When you install NextReports Designer a Derby demo data source is present with a report and a chart so you may start instantly and see how things work.

Because NextReports Designer is a free tool, we also created NextReports Engine a free, very light, fluent api used to run your reports and charts. You need your report object, a database connection, desired format and values for your parameters if any:

FileOutputStream stream = new FileOutputStream("test.html");
FluentReportRunner.report(report)
.connectTo(connection)
.withQueryTimeout(60)
.withParameterValues(createParameterValues())
.formatAs(ReportRunner.HTML_FORMAT)
.run(stream);


In a next article “How do you use your reports?” I will introduce NextReports Server and all the benefits you have with a centralized reporting server application.

Links


Published at DZone with permission of its author, Mihai Dinca - Panaitescu.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Alessandro Santini replied on Tue, 2011/04/12 - 4:11pm

I normally tend to delegate report generation to BI/Reporting tools already in place at the customer site. This does not mean that reporting comes as an afterthought, we simply ensure that the required data is available for their ETL tools in a convenient format.

Mihai Dinca - P... replied on Tue, 2011/04/12 - 11:48pm in response to: Alessandro Santini

I agree with you that many customers have BI tools. They payed for them and it is normal to use them. But there are customers which do not have such tools and they do not want to pay big bucks for some reasons : to expensive or to difficult to use. If your customer needs are requesting just for some functionality, it is better to look for alternatives. There is no perfect solution. You start with the requests and you can see what tools are suitable or not.

Mark Unknown replied on Wed, 2011/04/13 - 1:51pm

To me, reports are just another view (i.e. UI) and thus should not bypass the domain/service/etc. layer(s) nor any existing business logic. So I use tools that allow me to not be tightly coupled to the persistence layer. I take a long term perspective to development. I have had way too many issues where there was one set of code for "data entry" and another for reports and guess what? You would get different answers.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.