Skip to main content

Post 2: iReport for Java


Building Your First iReport
Welcome to the Post 2. In previous article we went through the Introduction of iReports and its basic structure. In this article, let us create a simple iReport in iReport Designer .

Follow the instructions and install Jasper Report Server in your machine .
After installation you w’ll get Jaspersoft Designer in your program list :


Select  Start iReport Designer from list , now we w’ll get a screen like this : 



Now to create a new report go to File and select new , now a window w’ll pop up like this, designer gives a variety of reports selection , but let’s select a simple template for now , select Report in left column and Blank A4 from right box.


Now click Open This Template from bottom and you w’ll get a window like this : 

Give a Report name and Location for your report and click next . 


Now click Finish , and we are done with creating a template .

Creating a data source or a database connection used to fill the report.
Now we w’ll setup database settings and connections to get dynamic data for our report .
To create the new connection in iReport, open the datasources/connections dialog by clicking its icon in the tool bar.
After clicking on this icon you w’ll get a window like this : - 

 
           

Click new from right side to create a new db connection : 



Select  a data source from a list of Datasources , lets select Database JDBC  connection fro now :
Click next , and add all the connection details :



Click save , now we are all set with our database connection .
Now we need some data  from database to display on the report , lets create a query to fetch data from database , to open query editor click on the icon as shown in picture below :



Clicking on this icon you w’ll get a query editor like this :


Now time to create a query to get required data .Once you are done with SQL query your window w’ll look like this : 
 


As you type the query, iReport executes it to extract all the fields (columns) available in the query. The fields are listed on the bottom portion of the window. If there is an error in the SQL, you'll get a message that explains what's wrong. When the query is valid, click OK. Now lets create some fields in our report to generate some pages .

To print the value of a field in the report, drag a field object from the report inspector to the design view.
 



To add other elements (such lines or labels), drag them from the palette Window :



If you don’t get the window select it from Window in menu : 



Now its all you need to design your report , after design is done your report w’ll look like this :



To see the resulting report go to Preview and see what you created : 


and here we go :



Congratulations, we have just created your first report. In next post that is post 3 we w'll cover Datasets  and Table component in Jasper Reports

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