How to combine/concatenate 3 string fields and create a new field

Six Stars

How to combine/concatenate 3 string fields and create a new field

Hi All,

 

I am new to Talend and I have requirement to create a new field in output easticsearch database.

 

My input has first name, lastname and middlename which are of string type.

 

And I want to concatenate these 3 fields and generate a new field in

output easticsearch database.

 

I want to get output like "fullname" : { "given" : "<source.firstname>", "middle" : "<source.middle>", "family" : "<source.lastname>" }

 

can some one help me how to do that in TMAP

 

thanks in advance.

 


Accepted Solutions
Nine Stars

Re: How to combine/concatenate 3 string fields and create a new field

Hello 

 

(row5.FirstName + " " +row5.MiddleName + " "+row5.LastName) .replaceAll("null","")

 

This is the bettter way to concatinate, Please give kudos and accept solution if it works

View solution in original post

Eleven Stars

Re: How to combine/concatenate 3 string fields and create a new field

if you need output string with double quotes

 

"\"fullname\" : {\"given\" : \"" 

+ row1.firstname +

"\", \"middle\" : \""

+  row1.middle +

"\", \"family\" : \""

+ row1.lastname +

"\" }"

Regards
Abhishek KUMAR

View solution in original post


All Replies
Nine Stars

Re: How to combine/concatenate 3 string fields and create a new field

Hello 

 

(row5.FirstName + " " +row5.MiddleName + " "+row5.LastName) .replaceAll("null","")

 

This is the bettter way to concatinate, Please give kudos and accept solution if it works

View solution in original post

Eleven Stars

Re: How to combine/concatenate 3 string fields and create a new field

if you need output string with double quotes

 

"\"fullname\" : {\"given\" : \"" 

+ row1.firstname +

"\", \"middle\" : \""

+  row1.middle +

"\", \"family\" : \""

+ row1.lastname +

"\" }"

Regards
Abhishek KUMAR

View solution in original post

Nine Stars

Re: How to combine/concatenate 3 string fields and create a new field

Thank you @ramneeru12  

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now