Talend Replace Data

The Talend Replace data or tReplace field used to replace a whole word or part of a word in the input rows and returns the output. We can use this Talend Replace data field to change the wrongly type data etc. In this Talend Replace data example, we used the Customer table.

Talend Replace Data 1

Talend Replace or tReplace Example

First, drag and drop the DBConnection, DBCommit, and DBInput to establish a SQL Server Connection. Next, we selected the Customers table from the metadata.

Talend Replace Data 2

Next, drag the Talend tRepalce from palette to job design. As you can see from the below tooltip, tReplace replaces and expression with another one.

Talend Replace Data 3

Please connect the DBInput main row to tReplace. Mostly, the input columns will sync with the tReplace. If that is not the case, click on the Sync columns button.

Talend Replace Data 4

Within the Components tab, there is a simple mode and an advanced mode. You can use advanced mode to write a regular expression. In the Search/Replace section, we have

  • InputColumn: Please select the column you want to use for search and replace.
  • Search: Please provide the search term that you want to search inside the column.
  • Replace with: Write the replacement term in this section.
  • Whole word: If you wish to perform on the entire word or part of a word.
  • Case Sensitive: Do you want to achieve the search in a case sensitive.

Before we perform anything, click the Edit Schema button to check or alter the tReplace schema as per your requirements.

Talend Replace Data 5

Next, click on the Add (plus) button. By default, it adds the first column, i.e., EmpID and defaults text.

Talend Replace Data 6

Please use the drop-down box to select the required column. Here, we chose the column as Education, Search term as Education, and Replace with BTech.

Talend Replace Data 7

After finishing the tRepalce Component configuration, we are using the DBOutput to save the Talend tReplace output in a SQL Database. Here, we are creating the Talend_repalce table as the destination table.

Talend Replace Data 8

Let us run the Talend Replace data Job.

Talend Replace Data 9

Let me open the Management studio to check the Talend tReplace result.

Talend Replace Data 10

This time, we are using two more fields and run the job. It means Talend tRepalce has to replace the Pro part (not the complete word) in the Occupation field with ABCD and John in the FirstName column with Suresh.

Talend Replace Data 11

Please check the Talend tReplace result.

Talend Replace Data 12

Let me select the Talend Replace field Advanced mode. As you can see, here, we can use the regexp pattern to search the string.

Talend Replace Data 13