Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

Talend tJavaRow

by suresh

Talend tJavaRow component accepts input rows, and generate the output rows. We can use this Talend tJavaRow to write a custom Java code to perform any transformation. In general, people coming from Java background use this tJavaRow to accomplish anything or everything. 

In this example, we use this Talend tJavaRow component to write a Java code that performs string conversations and mathematical operations.

Talend tJavaRow example

First, we used tDBConnection, tDBCommit, tDBInput to establish SQL connection, and select Customer table.

Talend tJavaRow 1

Next, drag the Talend tJavaRow component from palette to job design. From the tooltip, tJavaRow allows us to enter the main java code part of a component manually.

Talend tJavaRow 2

Within the Component tab, it has the java code section with some code sample and schema options. Please check the schema using the Edit Schema button.

Talend tJavaRow 3

Clicking the Generate Code button will generate the following code. It assigns the output row (tJavaRow output) values to input_row (values coming from tDBInput). It means, the following code will read all the records and assigned to tJavaRow.

Talend tJavaRow 4

Let me assign a tLogRow to tJavaRow to check whether the records are coming. From the below screenshot, you can see the result.

Talend tJavaRow 5

Let me add few more columns to the tJavaRow output by clicking the Edit Schema button in the Component tab.

Talend tJavaRow 6

As you can see from the below code:

  • FullName: Concatenation of First Name and Last Name and a space between them.
  • Upper_Edu = We used Talend toUpperCase() function to convert the Education column to Uppercase.
  • Lower_Occ = We used Talend toLowerCase() function to convert the Occupation column to Lowercase.
  • NewIncome: Here, we were adding a 15% bonus to existing income.
Talend tJavaRow 7

And the Java code that we used in the above is

output_row.EmpID = input_row.EmpID;
output_row.FirstName = input_row.FirstName;
output_row.LastName = input_row.LastName;
output_row.Education = input_row.Education;
output_row.Occupation = input_row.Occupation;
output_row.YearlyIncome = input_row.YearlyIncome;
output_row.Sales = input_row.Sales;
output_row.HireDate = input_row.HireDate;
output_row.FullName = input_row.FirstName + " " +input_row.LastName;
output_row.Upper_Edu = input_row.Education.toUpperCase();
output_row.Lower_Occ = input_row.Occupation.toLowerCase();
output_row.NewIncome = input_row.YearlyIncome + input_row.YearlyIncome / 15;

Please run the tJavaRow job to see the below result.

Talend tJavaRow 8

Let me replace the tLogRow with tDBOutput to save the result in a Talend_JavaRow.

Talend tJavaRow 9

Let us run the Talend tJavaRow job.

Talend tJavaRow 10

Please open Management Studio to check the result in the SQL table.

Talend tJavaRow 11

Placed Under: Talend

  • Talend Download and Install
  • Create a Talend Business Model
  • Create a Talend Job
  • Create a Global Context Group
  • Connect Talend to SQL Server
  • Context Group to connect DB
  • Talend Read Text File
  • Talend Read Excel File
  • Load Text File Data into Database
  • Load Excel Data into Database
  • Export Database Table to Excel
  • Export Database Table to TextFile
  • Export Database Table to XML
  • Export Database Table to JSON
  • Talend Aggregate Row
  • Talend Aggregate Sorted Row
  • Talend Buffer Input & Output
  • Talend Create Table
  • Talend tDenormalize
  • Talend Datatype Conversion
  • Talend tMap Type Conversion
  • Talend Filter Columns
  • Talend Filter Rows
  • Talend tMap filter rows
  • Talend tFileList
  • Talend tFixedFlowInput
  • Talend tForeach
  • Talend Fuzzy Matching
  • Talend Joins
  • Talend tMap Joins
  • Talend tMap Join Lookup
  • Talend tJava
  • Talend tJavaRow
  • Talend tJavaFlex
  • Talend tLoop
  • Talend tMsgBox
  • Talend tNormalize
  • Talend Pivot Columns
  • Talend Replace Data
  • Talend Replicate
  • Talend tRowGenerator
  • Talend tRunJob
  • Talend Rejected Rows
  • Talend Sample Row
  • Talend Sort Row Data
  • Talend SCD
  • Talend SCD Type 2 Manual
  • Talend Unite
  • Talend Unique Row
  • Talend Read Multi-Structure File
  • Talend Parent Child Job
  • Talend Execute SQL Queries
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy