How to set default values in the schema of a component - 6.4

Talend Big Data Platform Studio User Guide

EnrichVersion
6.4
EnrichProdName
Talend Big Data Platform
task
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

You can set default values in the schema of certain components to replace null values retrieved from the data source.

Note

At present, only tFileInputDelimited, tFileInputExcel, and tFixedFlowInput support default values in the schema.

In the following example, the company and city fields of some records of the source CSV file are left blank, as shown below. The input component reads data from the source file and completes the missing information using the default values set in the schema, Talend and Paris respectively.

id;firstName;lastName;company;city;phone
1;Michael;Jackson;IBM;Roma;2323
2;Elisa;Black;Microsoft;London;4499
3;Michael;Dujardin;;;8872
4;Marie;Dolvina;;;6655
5;Jean;Perfide;;;3344
6;Emilie;Taldor;Oracle;Madrid;2266
7;Anne-Laure;Paldufier;Apple;;4422

To set default values:

  1. Double-click the input component tFileInputDelimited to show its Basic settings view.

    In this example, the metadata for the input component is stored in the Repository. For information about metadata creation in the Repository, see Managing Metadata for data integration.

  2. Click the [...] button next to Edit schema, and select the Change to built-in property option from the pop-up dialog box to open the schema editor.

  3. Enter Talend between quotation marks in the Default field for the company column, enter Paris between quotation marks in the Default field for the city column, and click OK to close the schema editor.

  4. Configure the output component tLogRow to display the execution result the way you want, and then run the Job.

    In the output data flow, the missing information is completed according to the set default values.