tFileInputProperties - 6.1

Talend Components Reference Guide

EnrichVersion
6.1
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

tFileInputProperties properties

Component family

File/Input

 

Function

tFileInputProperties reads a text file row by row and extracts the fields.

Purpose

tFileInputProperties opens a text file and reads it row by row then separates the fields according to the model key = value.

Basic settings

Schema and Edit Schema

A schema is a row description, it defines the number of fields to be processed and passed on to the next component. The schema is either Built-in or stored remotely in the Repository.

For this component, the schema is read-only. It is made of two column, Key and Value, corresponding to the parameter name and the parameter value to be copied.

 

File format

Select from the list your file format, either: .properties or .ini.

 

 

.properties: data in the configuration file is written in two lines and structured according to the following way: key = value.

 

 

.ini: data in the configuration file is written in two lines and structured according to the following way: key = value and re-grouped in sections.

Section Name: enter the section name on which the iteration is based.

 

File Name

Name and path to the file to be created and/or the variable to be used.

For further information about how to define and use a variable, see Talend Studio User Guide.

 

Calculate MD5 Hash

Select this check box to verify that the file to be processed has been correctly downloaded.

Advanced settings

Encoding

Select the encoding type from the list or select Custom and define it manually. This field is compulsory for DB data handling.

 

tStatCatcher Statistics

Select this check box to gather the Job processing metadata at a Job level as well as at each component level.

Global Variables

NB_LINE: the number of rows processed. This is an After variable and it returns an integer.

ERROR_MESSAGE: the error message generated by the component when an error occurs. This is an After variable and it returns a string. This variable functions only if the Die on error check box is cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl + Space to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio User Guide.

Usage

Use this component to read a text file and separate data according to the structure key = value.

Scenario: Reading and matching the keys and the values of different .properties files and outputting the results in a glossary

This four-component Job reads two .properties files, one in French and the other in English. The data in the two input files is mapped to output a glossary matching the English and French terms.

The two input files used in this scenario hold localization strings for the tMysqlInput component in Talend Studio.

Dropping and linking the components

  1. Drop the following components from the Palette onto the design workspace: tFileInputProperties (x2), tMap, and tLogRow.

  2. Connect the component together using Row > Main links. The second properties file, FR, is used as a lookup flow.

Configuring the components

  1. Double-click the first tFileInputProperties component to open its Basic settings view and define its properties.

  2. In the File Format field, select your file format.

  3. In the File Name field, click the three-dot button and browse to the input .properties file you want to use.

  4. Do the same with the second tFileInputProperties and browse to the French .properties file this time.

  5. Double-click the tMap component to open the tMap editor.

  6. Select all columns from the English_terms table and drop them to the output table.

    Select the key column from the English_terms table and drop it to the key column in the French_terms table.

  7. In the glossary table in the lower right corner of the tMap editor, rename the value field to EN because it will hold the values of the English file.

  8. Click the plus button to add a line to the glossary table and rename it to FR.

  9. In the Length field, set the maximum length to 255.

  10. In the upper left corner of the tMap editor, select the value column in the English_terms table and drop it to the FR column in the French_terms table. When done, click OK to validate your changes and close the map editor and propagate the changes to the next component.

Saving and executing the Job

  1. Press Ctrl+S to save your Job.

  2. Press F6 or click the Run button from the Run tab to execute it.

The glossary displays on the console listing three columns holding: the key name in the first column, the English term in the second, and the corresponding French term in the third.