Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
JasperReports 3.5 for Java Developers

You're reading from  JasperReports 3.5 for Java Developers

Product type Book
Published in Aug 2009
Publisher Packt
ISBN-13 9781847198082
Pages 368 pages
Edition 1st Edition
Languages

Table of Contents (17) Chapters

JasperReports 3.5 for Java Developers
Credits
About the Author
About the Reviewers
Preface
An Overview of JasperReports Adding Reporting Capabilities to our Java Applications Creating your First Report Creating Dynamic Reports from Databases Working with Other Datasources Report Layout and Design Adding Charts and Graphics to Reports Other JasperReports Features Exporting to Other Formats Graphical Report Design with iReport Integrating JasperReportswith Other Frameworks Index

Report variables


When we wrote the report in the Report Expressions section, we had to type the following expression twice:

$F{fixed_wing_single_engine_cnt}.intValue() +$F{fixed_wing_multiple_engine_cnt}.intValue())

This expression was typed once to calculate the number of fixed-wing aircraft reported, and again to calculate the total number of aircraft reported. This duplication is not a good thing because, if we need to change the expression for any reason, we would have to do it twice. JasperReports allows us to assign report expressions to a variable, eliminating the need to type the expression multiple times. The following JRXML template is a modified version of the one we wrote in that section, this version takes advantage of report variables to eliminate the duplicate expression.

<?xml version="1.0" encoding="UTF-8"  ?>
<jasperReportxmlns="http://jasperreports.sourceforge.net/jasperreports"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}