Configuring the Jobs
Configuring the parent Job
Procedure
-
In the Context view:
-
Add the following three variables:
- filename, type String
- tablename, type String
- directory, type Directory
-
Specify the directory by clicking in the Value
field of variable directory. Click the small button
that appears and browse to the directory where the source files are
stored.
-
Add the following three variables:
-
In the Basic settings view of the
tFileList component, fill the
Directory field with
context.directory.
Information noteTip: Click in the field and press Ctrl+Shift to access a list of available variables.
-
Double-click the tIterateToFlow component to open its
Basic settings view, and configure the component as
follows:
- Add a column named filename (type String) in the schema editor.
- Fill the Value field of the Mapping table with the CURRENT_FILE global variable generated by the tFileList component, in the format of ((String)globalMap.get("tFileList_1_CURRENT_FILE")).
-
Double-click the tFixedFlowInput component to open its
Basic settings view, and configure the component:
- Add two columns in the schema: file_name (type String) and table_name (type String).
-
Select the Use Inline Table option, and define the
following file-to-table mappings in the table:
file_name table_name "customer_details.csv" "customer" "delivery_details.csv" "delivery" "employee_details.csv" "employee"
-
Double-click the tMap component to open the map editor.
In the map editor:
- Drag the filename column of table row1 (which is from the tIterateToFlow component) and drop it onto the file_name column of table row2 (which is from the tFixedFlowInput component), to join the two tables for file name look-up.
-
Click the spanner button to show the join properties, and set:
- the Match Model to Unique match
- the Join Model to Inner Join
- In the schema editor, add two columns to the out table: tablename (type String) and filename (type String).
- Drag the filename column of table row1 and drop it onto the filename column of table out.
-
Drag the table_name column of table
row2 and drop it onto the
tablename of table
out.
- Click OK to validate your settings and close map editor.
-
Double-click the tJavaRow component, and enter the
following code in the Code field.
context.tablename = out.tablename; context.filename = out.filename;
-
In the Basic settings view of the
tRunJob component:
- Click the three-dot button next to the Job field and select the child Job you want to call from the Repository Content dialog box, LoadDynamicSchemaChild in this example.
- Select the Transmit whole context option to pass the context variables to the child Job.
- Press Ctrl+S to save the Job.
Configuring the child Job
Procedure
-
In the Context view, add the following three variables,
leaving their values undefined:
- filename, type String
- tablename, type String
- directory, type String
-
Double-click the tFileInputDelimited component (labeled
Input_file) to open its Basic
settings view, and configure the component as follows:
- Open the schema editor and add a column data, and
set its type to Dynamic.
- Fill the File name/Stream field with the context
variables defined for file accessing:
context.directory+context.filename.Information noteTip: Click in the field and press Ctrl+Shift to access a list of available variables.
- In the Header field, specify the number of rows at
the beginning of the files to skip.
In this example, the first row of each file is the header row.
- Leave the other settings as default.
- Open the schema editor and add a column data, and
set its type to Dynamic.
-
Double-click the tDBOutput component (labeled
Write_to_DB) to open its Basic
settings view, and configure the component as follows:
- Specify the database connection details, including the host name or IP address, the port number, and database name, and the authentication credentials.
- Fill the Table field with the context variable defined for the table name, context.tablename in this example.
- From the Action on table list, select Default.
- From the Action on data list, select Insert.
- Click Sync columns to ensure the schema is the same as the input component: a single column named data, type Dynamic.
- Leave other options as default.
- Press Ctrl+S to save the Job.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!