Skip to main content Skip to complementary content

Configuring a Job using a tJava component

A common Job using tJava is generally composed of:

  • a tFileInputDelimited component to read data from a text file,
  • a tLogRow component to print data in the console,
  • a tJava component to retrieve the total number of records processed.

Procedure

  1. In the Palette, drag and drop a tFileInputDelimited , a tLogRow and a tJava component onto the workspace.
  2. Connect tFileInputDelimited to tJava using a Trigger > OnSubjobOk link.
  3. Set the Basic settings of the tFileInputDelimited component.
  4. Double-click on tFileInputDelimited to display its Basic settings. In the file name/steam field, add the source data file path "C:/person.txt".
  5. This file includes the following data:
    1;Shong
    2;Elisa
    3;Sabrina
  6. Click the Edit Schema button and set the two-column schema.
  7. Double-click on tjava to display its Basic settings view and add the following code in the Code area:
    int nb_line=(Integer)globalMap.get("tFileInputDelimited_1_NB_LINE");
    System.out.println("The total number of records are read from the text file is: " +nb_line);
  8. Execute the Job by pressing F6.

Results

The actual records from the input file are printed into the console natively. In addition, due to the use of the tJava component, the number of records also displays onto the console.

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!