Adding complex logic into a flow using tJavaRow
The tJavaRow
component allows Java logic to be performed for every record within a flow.
Getting ready
Open the job jo_cook_ch05_0020_tJavaRow
.
How to do it…
Add the
tJavaRow
andtLogRow
components.Link the flows as shown in the following screenshot:
Open the schema and you will see that there are no fields in the output. Highlight
name
,dateOfBirth
, andage
, and click on the single arrow.Use the + button to add new columns
cleansedName
(String) androwCount
(Integer), so that the schema looks like the following:Close the schema by pressing ok and then press the Generate code button in the main
tJavaRow
screen. The generated code will be as follows://Code generated according to input schema and output schema output_row.name = input_row.name; output_row.dateOfBirth = input_row.dateOfBirth; output_row.age = input_row.timestamp; output_row.cleanedName = input_row.age; output_row.rowCount = input_row.age;
Change the row
output_row.age = input_row.timestamp...