The child Job will read data from a text file, populate the total number of rows and pass the rows to the parent Job.
The input file, named in.txt, is as follows:
id;name 1;Shong 2;Elise 3;Sabrina
This Job will use the following components:
- a tFileInputDelimited component to read data from a text file and a tLogRow component to print it on the console,
- a tFixedFlowInput component to get the total number of rows read by the tFileInputDelimited component and a tBufferOutput component to buffer the value.
- Create a Job and name it childJob.
- Add a tFileInputDelimited component and a tLogRow component on the workspace and link them with a connection.
- Add a tFixedFlowInput component and a tBufferOutput component on the workspace and link them with a connection.
- Link the first subJob to the second one with a connection.
- Click the tFileInputDelimited component to open its Basic settings view and fill the File name/Stream with the in.txt file path and the Header field with 1.
- Click the [...] button next to Edit schema to open the schema dialog box and define the schema by adding two columns, id of Integer type and name of String type.
- Double-click the tFixedFlowInput component to create a column named nb_line of Integer type.
- In the Mode area, select Use Single Table and fill the Value cell with ((Integer)globalMap.get("tFileInputDelimited_1_NB_LINE")).