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

Index: JSF

Java Server Faces Basics Post 1: JSF : Introduction to JSF  Post 2: JSF:  configuration files  Post 3: JSF: Installation Post 4: JSF: Your first JSF project   Standard JSF Tags Post 1: JSF: textbox example Post 2: JSF: password example Post 3: JSF: textarea example JSF 2 GraphicImage Example Post 4: JSF: GraphicImage Example Post 101 : JSF : The valueChangeListener Attribute Example

Fresher's Walkins Bangalore: 16th March 2017

Read Walkin details properly , Try to call company before attending if possible !!! ____________________________________ 1. ACT Fibernet : Software Developers Interview Dates: 16th & 17th March 2017 Job Description: Candidate must have a bachelors degree( BE, B.Tech) . Must have scored above 60% in their graduation, XII,X grade exams. Experience level: 0 to 9 months. Good analytical & excellent communication skills. Good programming skills, and must be logical and analytical in thinking. Understanding of development best-practices and concepts, including reusability, extensibility and documentation of implemented code. Conceptual understanding of the structure and benefits of object-oriented programming language Conceptual understanding of SQL and RDBMS such as MySQL and Oracle. Good understanding on Operating system concepts Linux , Windows Understanding and experience (academic or on-the-job) in using C/C++/.NET/CSS/Java/JS/HTML languages to implement cod...

Index: iReport

iReport for Java ------------------------------------------------------------ Titles and Headers ------------------------------------------------------------ Post 1: iReport : Downloading, installing, and running JasperReports and iReport Post 2: iReport : Creating your first "Hello World" report   Post 3: iReport : Understanding iReport Elements Post 4: iReport : Creating and sizing the title for your report Post 5: iReport: Inserting a company logo in the title of your report  Post 6: iReport : Installation of PostgreSQL Post 7: iReport : Creating a report from relational data Post 8: iReport : Using dynamic titles that can change during report processing. Post 9: iReport : Adding a simple header to your report Post 10: iReport : Setting margins for your report and aligning the report header relative to report margins  ------------------------------------------------------------ Body and Footer ---------------------------------------------------------...