Defining the input components - Cloud - 8.0

Talend Job Script Reference Guide

Version
Cloud
8.0
Language
English
Product
Talend Big Data
Talend Big Data Platform
Talend Cloud
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
Module
Talend CommandLine
Talend Studio
Content
Design and Development > Designing Jobs
Last publication date
2024-02-22

In most circumstances you can start writing a Job script by adding the needed components. Follow the steps below to add and configure the components.

Procedure

  1. In the Job script editor, enter an addComponent {} function to start adding a component.
  2. In the addComponent {} function, enter the setComponentDefinition {} function and its parameters to define the component.

    Shown below are the minimal parameters required to define the type, the unique name, and the position of the first tFileInputDelimited component in this example.

    addComponent {
    	setComponentDefinition {
    		TYPE: "tFileInputDelimited",
    		NAME: "tFileInputDelimited_1",
    		POSITION: 192, 256
    	}
    }
    
  3. Next to the setComponentDefinition {} function, enter the setSettings {} function to specify the path to the source file, the number of header rows to skip, and optionally the label of the component displayed in the design workspace.

    In this example:

    	setSettings {
    		FILENAME : "\"E:/Talend/Data/Input/list_people.csv\"",
    		HEADER : "1",
    		LABEL : "people"
    	}
    Warning:

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

  4. Next to the setSettings {} function, type in an addSchema {} function and column definition parameters to define the component schema.

    For each column, just specifies the name and type and leave the other column properties as default. In this example, the main source file has four columns, all of type String: id, name, age, and city.

    	addSchema {
    		NAME: "tFileInputDelimited_1",
    		CONNECTOR: "FLOW"
    		addColumn {
    			NAME: "id",
    			TYPE: "id_String"
    		}
    		addColumn {
    			NAME: "name",
    			TYPE: "id_String"
    		}
    		addColumn {
    			NAME: "age",
    			TYPE: "id_String"
    		}
    		addColumn {
    			NAME: "city",
    			TYPE: "id_String"
    		}
    	}
  5. Use the steps above to add the second tFileInputDelimited component.

    This component will read a lookup input file that contains only two columns, both of type String: id and family.

    addComponent {
    	setComponentDefinition {
    		TYPE: "tFileInputDelimited",
    		NAME: "tFileInputDelimited_2",
    		POSITION: 192, 128
    	}
    	setSettings {
    		FILENAME : "\"E:/Talend/Data/Input/list_families.csv\"",
    		HEADER : "1",
    		LABEL : "families"
    	}
    	addSchema {
    		NAME: "tFileInputDelimited_2",
    		CONNECTOR: "FLOW"
    		addColumn {
    			NAME: "id",
    			TYPE: "id_String"
    		}
    		addColumn {
    			NAME: "family",
    			TYPE: "id_String"
    		}
    	}
    }