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

Highlighted
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
Highlighted
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

Highlighted
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
Highlighted
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

Highlighted
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

Highlighted
Nine Stars

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

Thank you @ramneeru12  

2019 GARTNER 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

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

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog