Book Image

JasperReports 3.6 Development Cookbook

By : Bilal Siddiqui
Book Image

JasperReports 3.6 Development Cookbook

By: Bilal Siddiqui

Overview of this book

<p>JasperReports is the world's most popular embeddable Java open source reporting library, providing Java developers with the power to easily create rich print and web reports. While such reports are pivotal in managing business information more effectively, creating and customizing them can get tedious.<br /><br />This book will give you recipes to solve common JasperReports problems to make your life easier. It will take you through complex examples related to JasperReports with step-by-step instructions on how to solve them.<br /><br />The author's experience in creating reports enables him to share over 50 recipes to develop crystal-clear business reports using the capabilities of JasperReports and the amazing features provided by its visual report designer tool: iReport.<br /><br />This cookbook will arm you to develop user-friendly reports by using multiple types of data in the same report, thereby saving your time in sorting, arranging, or extracting data and making the whole process effortless. First you will learn to do basic things such as creating, sizing, positioning, and enhancing the titles, headers, footers of the report. You will move on to working with the body and footer of the report, including using parameters to filter records during report processing and implementing nested hierarchy. Second, you will learn to enhance the look and feel of your report by deploying and reusing styles, and by using designs, textual effects, background images, and watermarks. You will also learn to use mathematical and logical expressions such as counting the number of records with a particular field value, grouping records, applying styles on your data based on logical or mathematical conditions, and so on.<br /><br />Then you will be able to do advanced things such as working with a variety of data sources: relational data, XML data, model beans of Java applications, and also multiple relational databases at once. You will learn to build a cover page and table of contents for multi-page reports, display multi-dimensional page numbering, and much more. You will be able to design simple and multi-level summary reports, cross-tabs with dynamic rows and columns, create bar charts, and display data trend graphs in your reports. Lastly and very importantly, you will be able to generate reports from Java Swing applications after you learn how to use JavaWrappers for your JasperReport.</p>
Table of Contents (13 chapters)
JasperReports 3.6 Development Cookbook
Credits
About the Author
About the Reviewers
Preface

Chapter 4. Working with a Variety of Data Sources

In this chapter, you will learn:

  • Creating a report from relational data

  • Connecting to an XML datasource

  • Creating a report from XML data using XPath

  • Using multiple relational databases to generate a report

  • Creating a report from model beans of Java applications

Introduction

This chapter is all about data sources. Application data resides in a variety of sources such as relational databases, XML data sources, and Java objects (model beans or Plain Old Java Objects). iReport will need to access these data sources in order to generate a report.

iReport uses the concept of loose coupling between data sources and report design. Loose coupling means you can design your reports independent of the type of data source used. This means the same report design can work with any data source. You will experience the advantage of this loose coupling while executing the recipes of this chapter.

Relational databases are perhaps the most popular data sources used to...