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
- In the Job script editor, enter an addComponent {} function to start adding a component.
-
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 } }
-
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.
-
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" } }
-
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" } } }