Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Thursday, October 27, 2011

Creating a Jasper Report from a CSV with Talend Open Studio

For the most flexibility in creating reports from Talend Open Studio, use the tJasperOutput component.  tJasperOutput uses Talend schemas, so it can be combined with any input source component like tOracleInput.  However, if your source is a CSV, you can use tJasperOutputExec and create the report with only one component.

The tJasperOutputExec component generates a Jasper Reports from a CSV file.  To configure the component, specify an input file and a source JRXML which is the report definition.  Set the report type (this example uses PDF).  Set the output directory and optionally an output file name.

tJasperOutputExec Creating a PDF
Jasper Reports

Jasper Reports can be created using an application called iReport Designer.  iReport Designer builds a formatted report using a variety of datasources including a CSV.  The output of iReport Designer is a JRXML file which contains the definition of the report.  iReport Designer or a Jasper Library will compile and interpret the JRXML file.

The following shows a CSV used in the example.

CSV File Input
iReport Designer incorporates the CSV by first defining a datasource and then a query.  The datasource points iReport Designer to the CSV file.  The query breaks the fields out of the CSV file.

Create a datasource.

CSV Datasource
Create a query from the datasource.  Press the "Get fields from datasource" button.
Report Query Based on CSV Datasource
Configuring a basic report is easy.  Drag the fields onto the Detail Band.  The column headers will appear as well.  This screenshot removes some of the default bands (footer, summary).
Creating a Jasper Report with iReport Designer

This is the PDF that results from this example.
PDF Created by Talend
There are a number of Jasper Reports tutorials on the Bekwam YouTube Channel.

tJasperOutputExec is an easy way to create a report (Excel, PDF, ODF, etc.) from Talend Open Studio when the data source is a CSV file.  For more flexibility, check out tJasperOutput which can also take a CSV file, but takes input from any component.

These are some examples of tJasperOutput:

2 comments:

  1. i am getting output but not *.pdf

    ReplyDelete
    Replies
    1. Does your Talend configuration match the first screenshot, specifically, that "PDF" appears as the report type?

      Delete