Defining the output component - 6.5

Talend Job Script Reference Guide

author
Talend Documentation Team
EnrichVersion
6.5
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 Real-Time Big Data Platform
task
Design and Development > Designing Jobs
EnrichPlatform
Talend CommandLine
Talend Studio

Follow the steps below to add and define the output component in this example, tFileOutputDelimited.

Procedure

  1. Next to the tMap component definition, enter another addComponent {} function, and inside this function enter the setComponentDefinition {} function and its minimal required parameters to add the output component.
    addComponent {
    	setComponentDefinition {
    		TYPE: "tFileOutputDelimited",
    		NAME: "tFileOutputDelimited_1",
    		POSITION: 736, 256
    	}
    }
  2. Next to the setComponentDefinition {} function, enter the setSettings {} function and parameters required to define the component properties:
    • The path to the output file

    • Whether to include the header in the output file

    • The encoding type of the output file

    • Whether to throw an error and stop Job execution if the specified output file already exists

    • The label of the component displayed in the generated Job on the design workspace

    	setSettings {
    		FILENAME : "\"E:/Talend/data/output/consolidated_list.csv\"",
    		INCLUDEHEADER : "true",
    		ENCODING : "\"UTF-8\"",
    		ENCODING:ENCODING_TYPE : "UTF-8",
    		FILE_EXIST_EXCEPTION : "false",
    		LABEL : "consolidated_list"
    	}
    Warning:

    Be sure to use a backslash (\) when specifying a metacharacter.

  3. Next to the setSettings {} function, enter an addSchema {} function to define the schema of the output component.

    Note that the column definitions of this schema must be the same as those of the output schema defined in the preceding component, tMap.

    addSchema {
    		NAME: "tFileOutputDelimited_1",
    		CONNECTOR: "FLOW",
    		LABEL: "out"
    		addColumn {
    			NAME: "id",
    			TYPE: "id_Integer",
    			LENGTH: 2
    		}
    		addColumn {
    			NAME: "full_name",
    			TYPE: "id_String"
    		}
    		addColumn {
    			NAME: "age",
    			TYPE: "id_Integer",
    			LENGTH: 2
    		}
    		addColumn {
    			NAME: "city",
    			TYPE: "id_String"
    		}
    	}