From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

Substring First ,Last Name from a FULL Name String in Talend

Highlighted
Five Stars

Substring First ,Last Name from a FULL Name String in Talend

Hi,

I'm new at Talend and I'm trying to do something very simple in  MYSql that I dont know how to do it here

For example:

I have a full neme as : "FName , LName MInitial Title"

I want to subtract just the Name and last name ignoring  the middel initial and the Title.

in sql is replace(SUBSTRING_INDEX (FULL_NAME,' ',2),',','') as NewName

Result : FName  LName

How I can achieve that?

Thanks in Advance


Accepted Solutions
Highlighted
Eight Stars

Re: Substring First ,Last Name from a FULL Name String in Talend

Hello NNYEZEL,

 

assuming that there is a blank before and after the comma, you can split the whole string at the blanks

and use the first and third result of the split. (The second would be the comma.)

 

row1.InputString.split(" ")[0] + " " + row1.InputString.split(" ")[2]

 

Best regards,

 

Thomas

 

View solution in original post

Highlighted
Five Stars

Re: Substring First ,Last Name from a FULL Name String in Talend

Hi,

Finally Works.. It take me a minute but is doing what I need...

Thank you for your help

row4.Name.split(",")[0] + " " + row4.Name.split(" ")[+1]

View solution in original post


All Replies
Highlighted
Eight Stars

Re: Substring First ,Last Name from a FULL Name String in Talend

Hello NNYEZEL,

 

assuming that there is a blank before and after the comma, you can split the whole string at the blanks

and use the first and third result of the split. (The second would be the comma.)

 

row1.InputString.split(" ")[0] + " " + row1.InputString.split(" ")[2]

 

Best regards,

 

Thomas

 

View solution in original post

Highlighted
Five Stars

Re: Substring First ,Last Name from a FULL Name String in Talend

Hi,

The solution almost work Smiley Sad

So the pattern is 'LName' 'space' 'comma' 'space' 'Fname' 'space' 'Mintial' 'Space' 'Title'

FULL NAME STRING =  Test , Name M MD

output is coming as  'Test , M MD'

should be

row1.InputString.split(" ")[0] + " " + row1.InputString.split(",")[1]???

 But is not working Smiley Sad

Thanks for all your help

Highlighted
Five Stars

Re: Substring First ,Last Name from a FULL Name String in Talend

Hi,

Finally Works.. It take me a minute but is doing what I need...

Thank you for your help

row4.Name.split(",")[0] + " " + row4.Name.split(" ")[+1]

View solution in original post

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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

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