Skip to main content

Post 3: iReport for Java


Datasets and Table component in Jasper Reports

Welcome to the Post 3. In previous articles we went through the Introduction of iReports and Building a Simple iReport . In this article, let us add some functionality to our report by adding a table and datasets .
Tables plays a very important role in every design , in iReports Tables are used to represent data in an efficient and usefull manner. Most of the time we need to iterate our dynamic data to display the output , in case of iReports this is done by Tables and Datasets .
Let’s take a brief look at how to use a Table Component to generate a simple tabular representation of data. The following are the basic steps we will take:
  1. Create a saperate Dataset so that we could iterate the data easily .
  2. Add a table component to detail band of the report , and set its  basic layout and structure.
  3. Put Dataset variables(Fields) in table to generate desired result.
  4. Preview the report to see the table functionality.
Creating a Dataset
To create a Dataset , right-click on your Report in Report Inspector and choose Add Dataset :




A setup window w’ll appear like this :


Provide a name to Dataset and let the first radio button selected for now , click next 



In Connections/Data Sourse select the  connection that is used to your main report . Enter an appropriate query that w’ll provide us data to use in table. Now click next
 
In left side of the screen designer w’ll show all the datafields that can be extracted from the query , add those fields to the right side that are going to be used in table. Now click next : 

Let this page empty as it for now , and click on Finish . Here we are done with Dataset , we can review and edit it from out Report Inspector, as shown in below image : 



Adding a table component to report.
Now we w’ll add a table on required position to do this go to Palatte section and select Table component :
Drop the Table component in Details Band , now a Table Wizard window w’ll pop up , like this :


Now we need to connect our Dataset to Table , just select appropriate Dataset from drop down list and click next : 

Now select Field that you want to use in your table , and click next :

Here we can select a db connection for our Table , let the very first radio button be selected for now , click next :



Here we can set layout and design for our table , click finish and we are done with it .After creating Table you w’ll get a Table View of Designer like this : 

Here we can add Headings and Data Fields to our table .In Main Reporst we can see an Table Icon like this , table position in the Report can be adjust from here 
 
No to see the result go to Preview and you w’ll get an table added to your report , like this
Here we are done with adding a table to our report .In next post we w'll cover How  to Create a sub report and pass parameters to it.

Comments

Popular posts from this blog

TIME TABLE: VTU BE/B.Tech June/July 2016 Exam Time table Draft Layout

Semester-wise June-July 2016 Exam time table (Draft Layout) Are You Using updated Kwikstudy App?

How to get VTU Provisional Degree Certificate (PDC) ?

Here is the procedure to get the Provisional Degree Certificate from the VTU by passed out candidates. You can get the certificate through post by sending the required documents to VTU. Documents and things required: 1. Provisional Degree Certificate (PDC) application form 2. DD of specified fees amount or print copy of receipt if you paid the fees online 3. A letter to the VTU registrar 4. A4 size envelope Step 1: Fill the PDC application You can download the PDC application form from the VTU website. Click below link for application download. PDC application form download     After downloading the application take a print of it and properly fill the form. Step 2: Make a DD of specified amount as the fees of PDC: Go to the bank and make the DD of prescribed fee amount for the PDC. The fee amount is specified in the above link from where you downloaded the application. Make the DD in favor of " Finance Officer, VTU Belgaum ".   Wr