Book Image

Pentaho 8 Reporting for Java Developers

By : Jasmine Kaur, Francesco Corti
Book Image

Pentaho 8 Reporting for Java Developers

By: Jasmine Kaur, Francesco Corti

Overview of 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.
Table of Contents (25 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Preface

How many times you have been asked to develop appealing reports with the most up-to-date technology in a few days (or probably less) in various different formats using a web-based solution or a custom Java project? If this is the case, this book will enable you to reach that goal using the dedicated tool of the Pentaho suite, named Pentaho Reporting.

This book is a definitive guide for Java developers and information technologists about the open source reporting tool, allowing you to create pixel-perfect reports of your data in PDF, Excel, HTML, text, RTF, XML, and CSV, based on a wide range of data sources, using a visual design environment and the SDK to embed the Pentaho Reporting Engine into your applications.

The book is written when Pentaho Version 8 were about to be officially released, and it is mainly based on this version. The description of the features, tips and tricks and best practices is done using a learning-by-example approach. To better guide you through the different topics and the definition of a learning path, the book is organized into four main parts:

  • Introduction and basics of Pentaho Reporting
  • Core concepts and advanced features of Report Designer
  • All about the Reporting SDK
  • Additional Pentaho Reporting topics

What this book covers

Chapter 1, Introduction to Pentaho Reporting, covers the typical uses, history, and origins of Pentaho Reporting, along with a more detailed overview of the reporting functionality that Pentaho Reporting provides.

Chapter 2, Getting Started with Report Designer, is focused on getting up and running with Pentaho Reporting. It'll begin by setting up an environment for building and embedding reports. From there, the reader will walk through creating a report using the wizard and will finish the chapter learning how to save the report into the filesystem.

Chapter 3, Getting Started with Reporting SDK, is about the Pentaho Reporting SDK. The reader will walk through embedding an existing report into a generic Java application.

Chapter 4, Creating a Report with Report Designer, goes one step further, covering the most commonly used features for creating a report from scratch instead of using the wizard. The core concepts, such as customizing the report, saving it in the Pentaho repository, and previewing the content, will be detailed step by step.

Chapter 5, Design and Layout in Report Designer, dives deep into all the concepts and functionality of Pentaho's Report Designer related to design and layout. The reader will explore in depth the ins and outs of design and layout of reports using the Pentaho Report Designer.

Chapter 6, Configuring JDBC and Other Data Sources, teaches you the configuration of the data sources in all the ways Pentaho Reporting is able to connect in. The data source definition will be shown using Pentaho Reporting Designer.

Chapter 7, Including Graphics and Charts in Reports, shows how to incorporate charts and graphics into Pentaho reports. You will learn about the different types of charts supported and how to configure them in Pentaho Report Designer. This chapter will also help you to populate a chart with various types of data.

Chapter 8, Parameterization, Functions, Variables, and Formulas, starts off by learning how to parameterize a report. This chapter covers all the predefined functions and expressions available for use within a report. It will help readers learn about Pentaho Reporting's formula capabilities, including the correct syntax and available formula methods.

Chapter 9, Internationalization and Localization, shows the details of internationalizing and localizing a report.

Chapter 10, Subreports and Cross Tabs, covers building from scratch some examples of subreports and cross tabs, exploring the capabilities offered by Pentaho Reporting. We will build a multi-page subreport that demonstrates the use of the sticky flag available for managing page headers and also build a subreport with a summary chart.

Chapter 11, The PRPT Format and the Java API to Build It, teaches Pentaho Reporting's PRPT bundle format, along with the details of Pentaho Reporting's Java API. This chapter focuses on the composition of the PRPT file representing the Pentaho report and how to build it using the Java API.

Chapter 12, Developing Using Data Sources, shows various methods of loading data into the Pentaho Reporting Engine, and digs deep into how the Pentaho Reporting Engine interacts with these data sources to render a report.

Chapter 13, Internationalization, Subreports, and Cross Tabs Using Java, covers the details of report parameterization. You also learn the various ways to dynamically render a report, including learning all the available functions and expressions but from a Java perspective.

Chapter 14, Building Interactive Reports, teaches you to enable interactive functionality within reports. You will also be able to modify report definitions to generate hyperlink events and many different HTML JavaScript events. You will learn how to render an HTML report on a server, along with including external script files within the HTML, rendered report.

Chapter 15, Using Reports in Pentaho Business Analytics Platform, shows the basics of the Pentaho Business Analytics Platform and the best practices on using Pentaho Reports stored in the repository or through dashboards.

Chapter 16, Using Reports in Pentaho Data Integration, covers how to use the developed Pentaho reports inside the Pentaho suite, particularly with Pentaho Data Integration (Kettle) to develop jobs/transformations managing Pentaho reports.

Chapter 17, Pentaho Reporting Nightly Build and Support, covers a potpourri of useful, short, and advanced Pentaho Reporting subjects.

What you need for this book

Pentaho Reporting tools are cross-platform applications and will run in Linux, Windows, macOS, and other Java supported environments. The Reporting Engine is backward-compatible with previous versions of JDK, but it is always recommended to use the latest one. In the case of Pentaho 8, JDK version 1.8 is suggested.

All the examples contained into this book are developed using an Ubuntu operating system v16.04 LTS with 4 GB of RAM and an Intel i7 processor. The development environment was composed by Java JVM 1.8.0_131, Apache Maven 3.3.9, Git version 2.7.4. This configuration is not mandatory for you to run the examples, but it is shared as a reference and suggestion to run the examples with success.

If you are an information technologist and don't want to cover the development tasks, Apache Maven and Git need not be installed into your laptop.                                                                                                                                                                

Who this book is for

This book is written for two types of professionals and students: information technologists with a basic knowledge of databases and Java developers with medium seniority. Developers will be interested to discover how to embed reports in a third-party Java application.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You will also learn the details of the Pentaho Reporting Engine data API specification, allowing you to implement your own DataFactory, if necessary."

A block of code is set as follows:

// Defining the connection provider. 
DriverConnectionProvider provider = new DriverConnectionProvider();
provider.setDriver("org.hsqldb.jdbcDriver");
provider.setProperty("user", "pentaho_user");
provider.setProperty("password", "password");
provider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// Defining the connection provider. 
DriverConnectionProvider provider = new DriverConnectionProvider();
provider.setDriver("org.hsqldb.jdbcDriver");
provider.setProperty("user", "pentaho_user");
provider.setProperty("password", "password");
provider.setUrl("jdbc:hsqldb:./resources/sampledata/sampledata");

Any command-line input or output is written as follows:

mvn clean install
 mvn package
 java -jar target/dependency/jetty-runner.jar target/*.war

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the OK button moves you to the next screen."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your email address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Pentaho-8-Reporting-for-Java-Developers. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/Pentaho8ReportingforJavaDevelopers_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.