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

Subreports using Java


As you learnt in Chapter 10, Subreports and Cross Tabs, subreports in Pentaho Reporting allow you to include fully featured reports inside a master report. In this section in particular, you will reach the same level of expertise from a Java perspective. In the following sections, you will go through the basics of Pentaho subreports, then you will move on to understand a fully working example of source code, available in the GitHub repository.

Subreports using Java

To understand the development of subreports using Java, let's describe the various components used for its definition. First is the SubReport class, used to declare and manage subreport instances in MasterReport. Differently from a regular element, a subreport is added to a report's band using the addSubReport(SubReport subReport) method.

As you saw in Chapter 10, Subreports and Cross Tabs, subreports always use a different data source for the content definition. Using Java, all the declared queries in MasterReport...