The following Job reads data from a .csv file and creates a .pdf report based on an existing .jrxml report template. Note that the template file should be created via Jaspersoft's iReport based on a file that shares the same schema with the source .csv file of this job.
Drag and drop the following components from the Palette to the workspace: tFileInputDelimited and tJasperOutput.
Connect tFileInputDelimited and tJasperOutput using a Row link.
Double-click the tFileInputDelimited component to display its Basic settings view.
Select Built-In from the Property Type drop-down list.
You can select Repository from the Property Type drop-down list to fill in the relevant fields automatically if the relevant metadata has been stored locally in the Repository. For more information about Metadata, see the Talend Studio User Guide.
Fill in the File name/Stream field to give the path and name of the source file, e.g. "C:/Documents and Settings/Andy ZHANG/nom.csv".
Keep the default settings for the Row Separator and Field Separator fields. You can also change them as needed.
Set 1 in the Header field and 0 in the Footer field. Leave the Limit field empty. You can also change them as needed.
Select Built-In from the Schema drop-down list and click Edit schema to define the data structure of the input file. In this case, the input file has 2 columns: Nom and Prenom.
Double-click tJasperOutput to display its Basic settings view.
Enter the full path of the report template file created via Jaspersoft's iReport in the Jrxml file field. You can click the three-dot button to browse.
The schema of the file, which is used to create a .jrxml template file via iReport, should be the same as that of the source file that is used to create the report.
Enter the path for the temporary files generated during the job execution in the Temp path field. You can click the three-dot button to browse.
Enter the path for the final report file generated during the job execution in the Destination path field. You can click the three-dot button to browse.
Enter the name for the final report file generated during the job execution in the File name/Stream field.
Select the format for the final report file generated during the job execution in the Report type field.
Click Sync columns to retrieve the schema from the previous component.
Enter the path of execution file of Jaspersoft's iReport in the iReport field, e.g. replacing __IREPORT_PATH__\ with E:\Program Files\Jaspersoft\iReport-4.1.1\bin\. You can click the Launch button to run iReport.
This step is not mandatory. Yet, this helps you conveniently access the iReport software for relevant operations, e.g. creating a report template, etc.