Skip to main content Skip to complementary content

Configuring the Jobs

Configuring the parent Job

Procedure

  1. In the Context view:
    1. Add the following three variables:
      • filename, type String
      • tablename, type String
      • directory, type Directory
    2. 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.
      Screenshot of the Context view.
  2. 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.
  3. Double-click the tIterateToFlow component to open its Basic settings view, and configure the component as follows:
    1. Add a column named filename (type String) in the schema editor.
    2. 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")).
  4. Double-click the tFixedFlowInput component to open its Basic settings view, and configure the component:
    1. Add two columns in the schema: file_name (type String) and table_name (type String).
    2. 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"
  5. Double-click the tMap component to open the map editor. In the map editor:
    1. 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.
    2. Click the spanner button to show the join properties, and set:
      • the Match Model to Unique match
      • the Join Model to Inner Join
    3. In the schema editor, add two columns to the out table: tablename (type String) and filename (type String).
    4. Drag the filename column of table row1 and drop it onto the filename column of table out.
    5. Drag the table_name column of table row2 and drop it onto the tablename of table out.
      Screenshot of the map editor.
    6. Click OK to validate your settings and close map editor.
  6. Double-click the tJavaRow component, and enter the following code in the Code field.
    context.tablename = out.tablename;
    context.filename = out.filename;
  7. In the Basic settings view of the tRunJob component:
    1. 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.
    2. Select the Transmit whole context option to pass the context variables to the child Job.
  8. Press Ctrl+S to save the Job.

Configuring the child Job

Procedure

  1. In the Context view, add the following three variables, leaving their values undefined:
    • filename, type String
    • tablename, type String
    • directory, type String
  2. 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.
      Screenshot of the schema editor.
    • 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.
    Screenshot of the component basic settings.
  3. 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.
    Screenshot of the component basic settings.
  4. 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!