{"id":11632,"date":"2018-08-11T08:00:26","date_gmt":"2018-08-11T08:00:26","guid":{"rendered":"http:\/\/www.icterra.com\/java-reporting-made-easy-with-dynamicjasper\/"},"modified":"2021-01-29T08:35:09","modified_gmt":"2021-01-29T08:35:09","slug":"java-reporting-made-easy-with-dynamicjasper","status":"publish","type":"post","link":"https:\/\/www.icterra.com\/de\/java-reporting-made-easy-with-dynamicjasper\/","title":{"rendered":"Java: Reporting Made Easy with DynamicJasper"},"content":{"rendered":"

Author:\u00a0<\/strong>Emre MORG\u00dcL, Senior SW Engineer \u2013 Defence Application SW Group<\/p>\n

\"\"<\/p>\n

Reporting is one of the most crucial and fundamental part of almost every application. Unfortunately, this process can easily become a programmer\u2019s nightmare depending on demands of users. Programmers need powerful and flexible reporting tools to meet these requirements. Fortunately, there are many reporting tools available for Java. Most powerful and popular one of them is\u00a0JasperReports<\/em>\u00a0[1]<\/a>. It is quite configurative and provides various features that allow user to generate exceptionally detailed reports. However,\u00a0JasperReports<\/em>\u00a0requires a template to build a report, which complicates things and limits its flexibility. So, what happens if we want to generate dynamic reports?<\/p>\n

DynamicJasper<\/em>\u00a0[2]<\/a>\u00a0is just the right tool for this purpose. It is built upon\u00a0JasperReports<\/em>\u00a0library. Therefore, it takes advantage of all the features\u00a0JasperReports<\/em>\u00a0provides. Besides, it is open source and extraordinarily easy to use. To create a dynamic report, all you need to do is have required libraries and write a few lines of code.<\/p>\n

DynamicJasper<\/em>\u00a0offers different ways of creating a report. Essentially, it needs a\u00a0DynamicJasper<\/em>\u00a0object to represent a reporting table. To build this object, they provide\u00a0DynamicReportBuilder<\/em>\u00a0class which implements builder design pattern, therefore, it allows an easy and readable way of configuring the table. In addition,\u00a0DynamicJasper<\/em>\u00a0offers other types of\u00a0ReportBuilder<\/em>\u00a0classes that extend\u00a0DynamicReportBuilder<\/em>.<\/p>\n

In my examples, I will use\u00a0FastReportBuilder<\/em>\u00a0class for simplicity because it automatically handles some of the non-crucial configurations.<\/p>\n

Building Simple Report with a Single Table<\/strong><\/p>\n