Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

TOS with JasperReport

Overview

Talend Open Studio (TOS), an open source platform, is used for Report creation and provides most compatibility for JasperReport. tJasperOutput component is used to run JasperReport from TOS. Currently, TOS along with JasperReport is the effective way to create reports.

iReport Designer is a Report Development tool for JasperReports and JasperReports server. Highly sophisticated layouts can be created with charts, images, sub reports, crosstabs, and much more. The data can be accessed through JDBC, TableModels, JavaBeans, XML, Hibernate, CSV, and custom sources. The reports can be published as PDF, RTF, XML, XLS, CSV, HTML, XHTML, text, DOCX, or OpenOffice.

TOS is used as a data source provider for JasperReport. Using Talend, you can access data from JDBC, XML, CSV, XLS, and so on. tJasperOutput Component allows report generation after executing every dataflow. This blog content will help you to generate reports using Mysql data source.

Use case

Generating a HTML report using MySQL data source.

What we need to do

  • Pre-requisites
  • Create data sources in MySQL
  • Use MySQL data sources
  • Design reports with conditions
  • Create Talend Job with MySQL data source
  • View reports

Pre-requisites

  • Install Jaspersoft iReport Designer 5.6.0
  • Install TOS for Data Integration 6.1.1

Creating Data Sources in MySQL

  • Open Jaspersoft iReport Designer.
  • Click create a database connection or setup a data source.
    • Select data source –> Database JDBC connection.
    • Enter connection details to connect with MySQL server

  • Create a new report (template based on column size of the data source) in the path:
    File –> New –> Reports –> Blank A4 Landscape (select any template).

Using MySQL Data Sources

  • Select a database from Report Data source.
  • Click Report Query.
  • Enter query to fetch data from database.
  • Click Read Fields to read all the fields given in the query.

Designing Reports with Conditions

  • Drag the needed fields from the field list and drop into Details Band.
  • Use Static Text for adding header.

  • To add style, choose the below path:Styles –> Add –> style –> Add conditional style –> Edit condition –> Expression Editor (add condition).Note: Adding conditional style to the Reports will highlight the records satisfying the condition.
  • Select fields for highlighting data and changing the style (select the style with condition) in properties.Fields with “High” Order Priority from the source will be highlighted.

  • Save the report as JRXML file.
  • Click Preview button to run and preview the result.You can also change the preview format by clicking “Preview” in Menu and by selecting different formats to view different outputs.

Creating Talend Job with MySQL Data Source

  • Open TOS.
  • Create a new Job in Job design.
  • Create a MySQL connection using tMysqlInput component.
  • Enter Query by selecting fields.
  • Add columns in Edit Schema.
  • Map with output columns.
  • Use tJasperOutput component to get the output file.
  • Select the format of result.

Viewing Reports

On running the Talend Job, the report will be produced in HTML format.

Conclusion

In this blog, we discussed about creating reports using TOS and Jaspersoft Ireport Designer. The reports can also be created in different formats such as HTML, PDF, RTF, ODT, Excel, text, and so on using different data sources such as JDBC, XML, CSV, Hibernate, Excel, and so on.



This post first appeared on Front-end Code Review & Validation Tools | Treselle Systems, please read the originial post: here

Share the post

TOS with JasperReport

×

Subscribe to Front-end Code Review & Validation Tools | Treselle Systems

Get updates delivered right to your inbox!

Thank you for your subscription

×