Home Data Pentaho 8 Reporting for Java Developers

Pentaho 8 Reporting for Java Developers

By Jasmine Kaur , Francesco Corti
books-svg-icon Book
eBook $43.99 $29.99
Print $54.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $43.99 $29.99
Print $54.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Introduction to Pentaho Reporting
About this book
This hands-on tutorial, filled with exercises and examples, introduces the reader to a variety of concepts within Pentaho Reporting. With screenshots that show you how reports look at design time as well as how they should look when rendered as PDF, Excel, HTML, Text, Rich-Text-File, XML, and CSV, this book also contains complete example source code that you can copy and paste into your environment to get up-and-running quickly. Updated to cover the features of Pentaho 8, this book will teach you everything you need to know to build fast, efficient reports using Pentaho. If your interest lies in the technical details of creating reports and you want to see how to solve common reporting problems with a minimum of fuss, this is the book for you.
Publication date:
September 2017
Publisher
Packt
Pages
470
ISBN
9781788298995

 

Chapter 1. Introduction to Pentaho Reporting

Pentaho Reporting is an easy-to-use, open source, lightweight suite of Java projects built for one purpose: report generation. In this book, you will discover how easy it is to embed Pentaho Reporting into your Java projects, or use it as a standalone reporting platform. Pentaho Reporting's open source license—the GNU Lesser General Public License (LGPL)—gives developers the freedom to embed Pentaho Reporting into their open source and proprietary applications at no cost. An active community participates in the development and use of Pentaho Reporting, answering forum questions, fixing bugs, and implementing new features. While many proprietary reporting options are available, none can offer the openness and flexibility that Pentaho Reporting provides its users with.

As with most successful open source projects, Pentaho Reporting has a proven track record, along with a long list of features. Most of this history has been documented in open forums and in email threads, which are still available for folks to browse through and glean ideas from. Starting as a side hobby and turning into an enterprise reporting suite over the course of many years, the Pentaho Reporting Engine and its suite of tools, such as the Report Designer, Reporting Engine, and Reporting SDK, are used as critical components in countless corporate, educational, governmental, and community-based information technology solutions.

In most business software applications, a reporting component is necessary, be it for summarizing data, generating large numbers of customized documents, or simply for making it easier to print information that would be useful in various output formats. With a complete set of features, including PDF, Microsoft Excel, HTML, Text, XML, CSV, and RTF report generation, along with advanced reporting capabilities such as subreports and cross tabs, Pentaho Reporting can crack the simplest of problems quickly, along with solving the more advanced challenges when designing, generating, and deploying reports.

Read on in this chapter to learn more about Pentaho Reporting, its typical uses, history, and origins, along with a more detailed overview of the reporting functionality that Pentaho Reporting provides.

In this chapter, you will cover the following topics:

  • Introduction to Pentaho Reporting
  • Typical uses of Pentaho Reporting
  • Pentaho Reporting history
  • Pentaho Reporting architecture
 

Introducing Pentaho Reporting


As introduced, Pentaho Reporting is an easy-to-use, open source, lightweight suite of Java projects, built to let the report developer be able to create pixel-perfect reports of his/her data in PDF, Microsoft Excel, HTML, Text, RTF, XML, and CSV formats. These computer generated reports easily refine data from various sources into a human readable form, and can be accessed via an integrated web viewer, saved as files and sent by email to a predefined list of recipients. It is also possible to generate reports as part of a Pentaho Data Integration transformation, to distribute the generated files according to more complex business rules (http://community.pentaho.com/projects/reporting).

Note

Pentaho Data Integration transformations are used to describe the data flows in a process, such as reading from a source, transforming data, and loading it into a target location. You will learn more in Chapter 16Using Reports in Pentaho Data Integration.

As it renders such high performance, consuming, considerably low amount of memory, the report processing can tower from small footprint embedded scenarios to large-scale enterprise reporting scenarios. Pentaho Reporting integrates perfectly with the Business Analytics Platform and allows you to share reports with coworkers and peers.

Pentaho Reporting styling is flexible and it permits the report designer to choose the granularity at which they desire to manipulate the entire user interface, right down to the minute details like the font styling on individual characters. In addition to this, you can also add your own images and logos to these reports and select from the various layouts, charts, and tables the one that you wish to apply.

Introducing Pentaho Reporting tools

Pentaho Reporting can be defined as a suite of open source tools and can be described as being composed of the following: 

  • Report Designer: This is a desktop application providing a design, develop, and test environment to enable the knowledge worker to easily create simple as well as complex reports. The tool is designed to be used by experienced and power users, who are familiar with few technical concepts.
  • Reporting Engine: This engine is born as an evolution of the JFreeReport project, a free Java class library for creating reports. The library can be used in both client-side (Report Designer, for example) and server-side applications (web applications, for example).
  • Reporting SDK: This is a packaging of several resources (the engine, some documentation, and all the libraries required to embed the Pentaho Reporting Engine into your application), to be a valid support for all the developers, particularly, for all the Java developers.

In this book, we will look at the Report Designer and the Reporting SDK in detail, assuming they are the right tools for developers and report designers, to use the Reporting Engine in real life use cases.

Types of users and required knowledge

Pentaho Reporting is designed and developed to make life easier for report designers, with less limitations on flexibility and the ability to develop sophisticated and rich reports. For this reason, the Report Designer can be used by developers (not necessarily Java developers) but also by information technologists with a basic knowledge of databases and technical concepts.

For advanced development, especially using the Reporting SDK, technical skills on Java development are required, and you must be familiar with importing JARs into a project and be comfortable reading inline comments in code, to figure out advanced functionality on your own.

If you are an information technologist with a basic knowledge of databases and technical concepts, the chapters dedicated to the Report Designer and how to use reports in Pentaho Data Integration and Pentaho Business Analytics Platform, are the topics you might be interested in. If you are a Java developer, the chapters about the Reporting SDK could also be interesting to you.

Technological advantages

Pentaho Reporting offers the following unique functionalities, not found in competing embeddable solutions:

  • Requires a Java runtime environment, not necessarily a JDK. Even if you need a JDK installed on your development environment, you do not need a JDK to run an application that embeds the Pentaho Reporting Engine. Only a Java runtime environment is required.
  • Potentially backwards compatible. In theory, Pentaho Reporting can run use dated versions of the Java virtual machine. Pentaho highly suggests to use JRE 1.8.0, but it is possible to use the Reporting Engine in older JRE versions (few integrations would be required).
  • All Processing is done in memory. All the processing, calculations, and algorithms are designed and developed to run in memory only, without the use of temporary files, tables, or any sort of memory mass usage.
  • Low memory requirement. An application based on Pentaho Reporting can run with only 64 MB of memory, even though 128 MB would dramatically increase the report processing speed.
  • Dynamically library loading. Pentaho Reporting Engine is able to detect JAR libraries at runtime. By adding new JARs or removing the existing ones, you can expand the engine's capabilities or remove unnecessary libraries to reduce your application's memory and disk space usage.
  • Parameterization at runtime. All the report elements, and we can say the same for styling, functions, and queries, are completely customizable through parameters passed to the Reporting Engine at run time.
  • OpenFormula standard. OpenFormula is an open standard that will be introduced in the next chapters. You will be able to create your own custom formulas or customize the existing ones using a known standard.
  • Easy resource management. Thanks to the use of the OpenDocument Format (ODF), the Pentaho Reporting Engine can bundle all the requested resources, including the data source connection information, query, and even binary resources like images into a regular file, simplifying the resource management.

A business friendly open source license

One very attractive feature of Pentaho Reporting is its license. Pentaho Reporting is available for free under the GNU LGPL. This license, as shown in the following screenshot, allows other open source and proprietary projects to embed Pentaho Reporting without fear of large license fees or viral open source limitations. As an open source project, developers also have unprecedented access to the engine and to a large group of software developers within the Pentaho Reporting community. This community includes open discussion forums and Internet Relay Chat (IRC), along with commercial support and licensing, if required.

 

Typical uses of Pentaho Reporting


Business users need access to information in many different forms for many different reasons. Pentaho Reporting addresses the following typical uses of reporting, along with many other types that will be covered in this book.

Operational reporting

One of the most commonly used forms of reporting is operational reporting. When a developer or an IT organization decides to generate reports directly from their operational data sources for the purpose of detailed transaction level reporting, it is referred to as operational reporting. In this scenario, the database is designed to solve an operational problem, and usually contains live data supporting critical business functions. Users of Pentaho Reporting can point directly to this data source and start generating reports.

Some examples of operational reporting include building custom reports directly based on a third-party software vendor's database schema. These reports might include summaries of daily activity, or detailed views into a particular project or users in the system. Reports might also be generated from data originating from an in-house custom application. These reports are typically based on an SQL backend, but could be generated from flat log files or directly from in-memory Java objects.

Pentaho Reporting's parameterization capabilities provide a powerful mechanism to render up-to-the-minute customized operational reports. With features such as cross tabs and interactive reporting, business users can quickly view their operational data and drill back into operational systems that might require attention.

However, there are limitations when developing reports based on live operational data. Developers need to be careful to make sure that queries in the operational system do not impact the performance of regular operations. An extreme CPU-intensive query could delay a transaction from taking place. Also, certain historical questions, for example, state transitions or changes to particular informational fields such as address, aren't traditionally captured in an operational schema design.

Business intelligence reporting

When you've reached the limits of operational reporting, the next logical step is to move your data into a data warehouse. This move is often referred to as business intelligence reporting. Reporting alone does not provide the necessary tools to make this transition. You will need an Extract, Transform, Load (ETL) tool, such as Pentaho Data Integration, along with a sensible warehouse design, such as a snowflake schema.

Note

A snowflake schema is a logical arrangement of tables in a multidimensional database, such that the entity relationship diagram resembles a snowflake shape. A multidimensional database is defined as "a variation of the relational model that uses multidimensional structures to organize data and express the relationships between data".

This type of use allows business users to monitor changes over time. It also helps gain performance benefits by pre-calculating aggregations and defining schemas that are built in mind for summarized reporting. Until recently, data warehousing and business intelligence had been limited to large enterprises due to the cost of software and limited expertise. With open source tools becoming more widely available, a large number of small and medium size businesses are deploying data warehouses in order to get solutions for the critical questions in their business domain. Common examples of data warehouse reporting include combining sales and inventory data into a single location for reporting, or combining internal proprietary sales data with publicly available market trends and analysis.

Pentaho Reporting's flexible data source support makes it easy to incorporate reports in your business intelligence solutions. Also, with Pentaho Reporting's speed and scalability, you can deploy Pentaho Reporting with the confidence that reports will be executed efficiently.

As with all approaches, there are limitations to this approach. In traditional warehousing, data is usually batched nightly, weekly, or monthly. Therefore, business users rarely get to see up-to-the-minute reports on business operations. Also, when designing a warehouse, it is important to ask the correct business questions. Unfortunately, it is possible to build a data warehouse and still not address the business users' needs, if not investigated ahead of time.

Financial reporting

The financial reporting is a very specific, but very common, form of reporting, geared towards generating financial summaries for accountants, managers, and business investors. Standard reports that fall into this category include balance sheets, income statements, retained earning statements, and cash flow statements. Unlike business intelligence or operational reporting, many of these reports are required by law, with regulations around their content and presentation. Financial reports often include computations for assets, liabilities, revenues, and expenses.

Following is a screenshot showing one such report:

With features such as group summary aggregations, Pentaho Reporting makes it very easy for developers to implement custom financial reports that business managers and owners require.

Typically, this type of data exists in a controlled form, be it in a proprietary system such as QuickBooks or SAP, or in a secure database system such as Oracle or MySQL. Due to the sensitivity of this data, developers need to be conscious of who has access to the reports and may want to implement features such as audit logging.

Production reporting

Another typical use of Pentaho Reporting includes production reporting. This type of reporting includes reports such as customized form letter, invoice, or postcard for a large audience, as well as automated mail merging. Normally, batch processing is involved in this form of reporting. However, custom reports based on a standard template, generated for individuals, can also fall under this category. 

The following is a screenshot that presents such a report:

There are certain specific features in Pentaho Reporting, such as dynamically incorporating images from a data source, as well as pixel accurate formatting, which can be of real help when implementing production reporting.

 

Pentaho Reporting history


Pentaho Reporting began as JFreeReport, a Java-based Reporting Engine and Swing widget, back in 2002. David Gilbert, author of JFreeChart, implemented the initial version of JFreeReport to address report rendering needs. Soon after launching the project, Thomas Morgner became the primary developer. He added critical functionalities, such as report functions and XML report definitions, launching JFreeReport into a successful open source Java project.

Since the beginning, Pentaho Reporting has been an international project. David was located in Hertfordshire, United Kingdom, and Thomas was located in Frankfurt, Germany. Many others from all over the world have contributed translations and code to Pentaho Reporting.

From 2002 to 2006, Thomas continued to develop JFreeReport into an enterprise-worthy Reporting Engine. While working as a consultant, Thomas added support for a variety of outputs, including Excel and RTF. At the beginning of 2006, Thomas and JFreeReport joined Pentaho, an open source business intelligence company, and JFreeReport officially became Pentaho Reporting. At this time, Thomas transitioned from a full-time consultant to a full-time developer on the Pentaho Reporting Engine and suite of tools.

In January 2006, along with the acquisition of Pentaho Reporting, Pentaho announced the general availability of the Pentaho Report Design Wizard, which walks business users through a set of simple instructions for building sophisticated template-based reports. Mike D'Amour, a senior engineer at Pentaho, was the initial author of this wizard, which is now used in many Pentaho applications.

Another important milestone in Pentaho Reporting's history was the introduction of Pentaho Report Designer. In 2006, Martin Schmid contributed the first version of the Pentaho Report Designer to the community. Since its introduction, the Report Designer has evolved with the Reporting Engine.

In 2007, Pentaho teamed up with Sun's OpenOffice to deliver a reporting solution for OpenOffice's database tool set. This project was headed by Thomas Morgner, and is now known as the Pentaho Reporting Flow Engine. While this engine shares many of the concepts from the classic engine discussed in this book, it is a separate project with dramatically different features and functionalities than Pentaho's classic reporting project.

Beginning in Pentaho Business Intelligence Platform release 1.6, Pentaho Reporting also tightly integrates with Pentaho's Metadata Engine, allowing easy-to-use web-based ad hoc reporting by business users who may not have SQL expertise, data driven formatting in reports, as well as column and row level data security. The same functionality is available inside Pentaho Report Designer for query and report building, allowing business users to go from a quick template-based report to a full-fledged custom report.

Today, Pentaho Reporting is definitely a core part of the Pentaho platform, and it is maintained and enhanced as a official and powerful component of the entire business intelligence suite.

 

Feature overview


In this quick introduction to the various features available in Pentaho Reporting 8, you'll have an executive summary of how Pentaho Reporting works and what it can accomplish for your reporting needs. The topics that will follow are covered in more depth in later chapters of the book.

An advanced reporting algorithm

The reporting algorithm is at the heart of Pentaho Reporting. This algorithm manages the layout and rendering of the entire report, no matter which output format is being rendered. This algorithm combines a reporting template and a dataset on the fly, in order to generate the final report. There is no unnecessary compilation step. All other Pentaho Reporting features can be described in the context of the overall reporting algorithm.

This algorithm allows reports to render with a page header and footer, a report header and footer, group headers and footers, as well as a details band. The reporting algorithm traverses the dataset multiple times to render the report. In the first pass, the algorithm performs calculations and determines how to separate the data into groups, along with calculating the height and width of text and images. After the initial pass, the algorithm traverses the dataset a second time, in order to render the output.

A multitude of available data sources

Pentaho Reporting defines a standard Java API for accessing data. Many data source implementations are made available with Pentaho Reporting. The most commonly used implementations include JDBC and JNDI database connectivity, XML XPATH capability, and multidimensional OLAP data access using MDX and MongoDB NoSQL database support.

Note

Java Naming and Directory Interface (JNDI) is a Java API for a directory service that allows Java software clients to discover and look up data and objects via a logical name, decoupling the implementation from the configuration and settings.Online Analytical Processing (OLAP) is an approach to answering multidimensional analytical queries swiftly in computing. Multidimensional Expressions (MDX) is a query language for OLAP databases. Much like SQL it is a query language for relational databases.

Additional data sources that are available include a Pentaho Data Integration data source, a Hibernate Query Language (HQL) data source, a Pentaho Metadata data source, a scripting data source (in JavaScript, Python, TCL, Groovy, and BeanShell), a simple table defined as a static list of rows and columns, and other advanced data sources (OpenERP data access, community data access, and sequence generator).

Using Pentaho's Data Integration data source, it is easy to use Excel, logs, or other file formats as inputs to a report, without the need to write any code. All these data sources interact with the Reporting Engine through a standard API, which is easy to extend.

The following screenshot shows the available data sources in Pentaho Reporting:

By combining Pentaho Reporting's data source functionality with Pentaho's Data Integration Engine, most known data formats and systems are available for input. This includes combining data sources into a single report. An example might include a Microsoft Excel file on a remote shared drive, with a plain text log file from an HTTP server.

A wide variety of output formats

Pentaho Reporting has the ability to render to the most widely used output formats, including Adobe's PDF standard using the iText library, Microsoft's Excel standard using the POI library, and HTML, all highlighted in the following screenshot. Other available formats include XML, plain text, RTF, and CSV. In addition to these output formats, a Pentaho report can be rendered in Swing and directly printed using PostScript formatting, allowing print previewing capabilities.

The following is a screenshot showing one such report obtained using Report Designer and rendered in PDF (top left), Microsoft Excel (top right), HTML (bottom left), and CSV (bottom right):

Pixel accurate rich formatting

Reports defined in Pentaho Reporting can specify at the pixel level where objects such as text or images should render. Using Pentaho Report Designer, it is easy to align fields and group items that need to stay aligned. While not always possible due to different format types, such as XML, CSV, and plain text, the three main graphical outputs, HTML, PDF, and Excel, strive to look as similar as possible.

Rich formatting includes the TrueType system font selection, the ability to render geometrical shapes and lines, along with the ability to include images and other objects in a report. This rich formatting is specified under the covers through styles similar to CSS, separating out the format from the report detail. This makes it easier to modify and maintain reports, and also to apply corporate styles through the report wizard, as shown in the following image:

Embedded charts

The Pentaho Reporting Engine and suite of tools make it easy to embed charts in reports, originally developed using the JFreeChart Engine. Many chart types are available, including bar, histogram, pie, and line charts, as shown in the following diagram:

Report parameterization

Pentaho Reporting provides easy-to-use tools to parameterize a report, allowing users to specify ranges and other values to customize the output of a report. Parameter values can be selected from a list of hardcoded values or driven from a query. With parameterization, end users may control the amount of information that is displayed on a report. The following screenshot is an example of parameter input from within Pentaho's business intelligence server:

Formulas and style expressions

Report builders may define custom formulas and style expressions, using the OpenFormula standard, allowing for calculated values and dynamic formatting in their reports, such as aggregations, number formatting, as well as traffic lighting.

Subreports

Pentaho Reporting allows report developers to include subreports within a master report. This provides a powerful capability, which allows reports to contain different smaller reports, both side-by-side and within the various bands of a report. These subreports may be based on different data sources. The following screenshot is an example of a report that includes a separate chart subreport:

Cross tab reports

Cross tab reports present data in a spreadsheet-like format, making it easy to view summaries of data. Cross tab reports present both row and column headers, as well as cells of data, all of which can be customized through report elements. The following image shows how a cross tab report looks:

Interactive reporting

While most reports are static after being rendered, a subset of reporting includes functionalities such as drill through, pivoting, and other interactivity. Pentaho Reporting provides a straightforward Java and JavaScript API for manipulating a report after it has been rendered, allowing report builders to create very interactive reports. Pentaho Reporting's interactive functionality is available when rendering a report in HTML, Excel, or Swing. Links to external documents can also be added to PDF documents.

The following screenshot shows a report with links, that when clicked, collapses/expands the row in detail:

Rich authoring tools

While it is possible to build Pentaho reports using either XML or a Java API, most reports begin as templates built by the Pentaho Report Designer. Pentaho Report Designer is a What You See Is What You Get (WYSIWYG) report editor that exposes the rich set of features provided by the Pentaho Reporting Engine. In addition to building a report from scratch, the Report Design Wizard, included as a part of the Pentaho Report Designer, walks a report author through building a report, which will then be displayed in the Report Designer, as shown in the following screenshot, for further customization:

Reporting server

As part of the Pentaho suite, reports created by Pentaho Reporting may be published, executed, and scheduled on Pentaho's Analytics Platform. The Pentaho Analytics Platform offers authentication and authorization, as well as a central repository, to manage your business reports. The Pentaho Analytics Platform also hosts the web-based ad hoc reporting user interface for creating Pentaho Metadata-based reports. By combining the use of Pentaho Report Designer and Pentaho Analytics Platform, there is no need to write any code to get your business up and running with Pentaho Reporting.

Java API for building reports

Pentaho Reporting comes with a well-documented Java API for building reports from the ground up, so developers can stick with the Java programming language when customizing existing report templates or building reports from scratch. This Java API allows the developers to create and modify the various sections of a report, including the various header, footer, group, and detail bands, along with creating and modifying objects within each section of a report.

Extensibility

Pentaho Reporting is designed from the ground up in pure Java, exposing many interfaces for extension. From implementing basic formulas and functions that can be embedded in reports, to writing a custom data source or output format, Pentaho Reporting's source code and API interfaces are well documented and easy to work with.

Pentaho reporting website

In addition to these features, Pentaho Reporting is in active development. Visit http://community.pentaho.com/projects/reporting/ to learn more about what additional features and functionalities are being considered for development, or to access early release versions of the product.

 

Pentaho Reporting architecture


Pentaho Reporting Engine is mainly a Java class library, broken up into other Java projects, which are then combined to render reports. The library is optimized for performance and a small memory footprint, and can run completely in memory without generating temporary files or requiring extra compilation steps. The source code is available, under the terms of the GNU LGPL Version 2.1, in the GitHub repository https://github.com/pentaho/pentaho-reporting.

The GitHub repository includes the Pentaho Report Designer, providing a graphical editor for report definitions and used as a standalone desktop reporting tool. In addition, there are also other related open source tools and projects in the Pentaho Reporting landscape, including the Report Engine Demo, Report Design Wizard, Report Designer, and the web-based ad hoc reporting user interface.

The following is an introduction of the Java project defining the Pentaho Reporting Engine, with a focus on the libraries, the Reporting Engine core, and the Reporting Engine extensions.

Reporting Engine's libraries

The Pentaho Reporting Engine uses the following libraries to render reports:

  • Flute: This is a CSS 2 parser written in Java that implements SAC (https://www.w3.org/Style/CSS/SAC/). SAC is a standard event-based API for CSS parsers, closely modeled on the SAX API for XML parsers.
  • LibBase: This is the root library for all other Pentaho Reporting libraries. This library contains common capabilities, such as debug and error logging utilities, library configuration, along with library initialization APIs, for consistent startup and shutdown management of the Reporting Engine.
  • LibDocBundle: This abstracts the management of Pentaho Reporting file bundles, which are by default stored as ZIP files, and implements the ODF. This makes it simpler for other parts of the Reporting Engine to work with and manipulate Pentaho Reporting's file formats.
  • LibFonts: This allows Pentaho Reporting to work with TrueType system fonts, extracting the necessary metadata from font types and populating an abstract interface to allow appropriate rendering in various contexts, including PDF and Excel views.
  • LibFormat: This is a string formatting library, which can render dates and numbers appropriately, based on format strings. This library is focused on memory and CPU efficiency for high performance report rendering.
  • LibFormula: This is a formula parsing and execution library based on the OpenFormula standard. You can learn more about OpenFormula by visiting http://wiki.oasis-open.org/office/About_OpenFormula. This library is similar in function to Excel-based formula definitions. LibFormula is a very general library and is used outside Pentaho Reporting in other projects that require OpenFormula style parsing and execution. LibFormula-UI is a formula editor for OpenFormula expressions based on LibFormula.
  • LibLoader: This manages the loading and caching of all necessary resources required for generating reports in a generic way, providing a simple API for other parts of the Reporting Engine that control static and dynamic content, including data sources and images.
  • LibPensol: This is an access layer for accessing a remote Pentaho solution repository via an Apache VFS filesystem. It handles all HTTP calls, the parsing of the XML file, and all client-side state managements.
  • LibPixie: This is a WMF-file reading library, originally written by David R. Harris as converter for the Pixie-image viewer. Pixie was long time dead and has now been resurrected as WMF-reader and image producer for Java 1.2.2 or higher. Pixie lacks the support for most bitmap-formats, but everything else works fine.
  • LibRepository: This abstracts the input and output of hierarchical storage systems, such as file systems, that Pentaho Reporting interacts with. This makes it possible for a custom storage system, such as FTP, to be implemented and to be mapped to the API, giving Pentaho Reporting access to the system.
  • LibSerializer: This provides helper methods for serializing non-serializable objects. This is necessary so that the Reporting Engine can serialize standard Java classes that don't implement Java's serializable interface.
  • LibSparkline: This is a library developed to render sparkline graphs. Sparklines are small-scale bar or line charts that are inserted into text to provide visualized information along with the textual description.
  • LibSwing: This is a common helper class storage for design-time elements, so that they don't have to move into the engine project, where they potentially bloat up the project due to third-party dependencies or a large amount of code.
  • LibXml: This provides utility classes for Simple API for XML (SAX) parsing and XML writing, based on Java's Java API for XML Parsing (JAXP) API. This library assures the speedy loading and validation of Pentaho Reporting XML template files.

Reporting Engine core

The Reporting Engine core project contains the main reporting algorithm for rendering reports, along with the necessary functionality to support styling. This project also contains the algorithms for rendering specific outputs, including PDF, Excel, CSV, XML, and more. The engine relies on the already mentioned libraries for managing the loading, parsing, formatting, rendering, and archiving of generated reports.

Reporting Engine extensions

The Reporting Engine extensions project contains third-party extensions to the Reporting Engine, which are very useful, but increase dependencies. Extensions in this project include JavaScript expression support using the Rhino project, a hibernate data source factory, bar code support using Barbecue, sparkline support using the LibSparkline, along with additional JDK 1.4 support for configuration and printing. Additional extension projects exist that include charting and many of the data sources discussed in this book.

Note

The following are some links to the quoted projects for further details: Rhino: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino Hibernate: http://hibernate.org Barbeque: http://barbecue.sourceforge.net

 

Summary


In this chapter, we introduced Pentaho Reporting and highlighted some typical uses, providing you with baseline ideas for implementing your own solutions. Typical uses for embedded reporting include operational, business intelligence, financial, and production reporting.

We briefly described the unique history of Pentaho Reporting, from its JFreeReport roots, and also learned a great deal about the rich features included in the release 8.0. Core features include a wide variety of data source integration, along with PDF, HTML, and Excel rendering. On the other hand, more advanced features include subreports and cross tab reports. Additionally, developer-oriented features, such as open Java APIs, along with the available source code and a business-friendly LGPL open source license, gives Pentaho Reporting a leg up on all other Java reporting toolkits.

The architecture of Pentaho Reporting is also covered in this chapter, providing developers with a twenty thousand foot view of where they might be able to modify or contribute to the Pentaho Reporting Engine, along with giving them the ultimate flexibility of access to source code.

You'll soon be able to apply the rich feature set of Pentaho Reporting to your use case.

In the following chapter, we'll introduce you to Pentaho Reporting's easy to use Report Designer and Java API, making it fun and easy to embed reporting into your Java application.

About the Authors
  • Jasmine Kaur
  • Francesco Corti

    Francesco Corti is an enthusiastic consultant in software solutions and loves working in developer, sales, and customers teams. Proud of the role of a software engineer, he is often involved in pre-sales presentations, public speaking, and IT courses. Developing software, designing architectures, and defining solutions in ECM/BPM and BI are his favorite areas of interest. He has completed dozens of projects, from very small ones to more complex ones, in almost 20 years of experience. A product evangelist at Alfresco, Francesco represents the famous open source ECM in the developer community. In addition to helping developers adopt Alfresco technologies, he often helps Alfresco to improve the developer experience through talks, articles, blogging, user demonstrations, recorded demonstrations, or the creation of sample projects. He is the inventor and principal developer of Alflytics (previously named Alfresco Audit Analytics and Reporting), the main business intelligence solution over Alfresco ECM, entirely based on the Pentaho suite. He authored the Pentaho Reporting video course with more than 40 videos and courses on the Pentaho Reporting Designer and SDK. Francesco has specialty and principal experiences in enterprise content management solutions with Alfresco ECM and Hyland OnBase (he is an OnBase certified installer); business process management solutions with Activiti, JBPM, and Hyland OnBase; data capture solutions with Ephesoft, Hyland OnBase, and custom software; record management solutions with O'Neil software and custom software (using Alfresco ECM and Hyland OnBase); and portal and collaboration with Liferay and MS SharePoint.

    Browse publications by this author
Latest Reviews (1 reviews total)
Era justo lo que me hacía falta
Pentaho 8 Reporting for Java Developers
Unlock this book and the full library FREE for 7 days
Start now