extract fullname to firstname and middlename and lastname

Seven Stars

extract fullname to firstname and middlename and lastname

Hi 

I have an input like below

Input File Data

Smith,john

James,Jones K

Joseph J Walker

 

Need Expected Output like below split FullName column to 3 different Columns

FirstNameMiddleNameLastName
John Smith
JamesKJones
JosephJWalker

kindly help on this i tried using textractregexfield component but not able to get expected output

 

Regards,

Meena


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

You just have to check the last part length to decide if you have to get the middle or the last part to populate the lastname:

Capture.png

Here is the result:

[statistics] connecting to socket on port 3468
[statistics] connected
.---------------+------+------+------.
|             tLogRow_1              |
|=--------------+------+------+-----=|
|fullname       |first |middle|last  |
|=--------------+------+------+-----=|
|Smith,john     |Smith |john  |null  |
|James,Jones K  |James |K     |Jones |
|Joseph J Walker|Joseph|J     |Walker|
'---------------+------+------+------'

[statistics] disconnected

Thank's to mark you case as solved (Kudos also accepted as a bonus).


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

Based on this answer I have proposed to someone else, you should be able to do what you want.

Start by replacing comma by space using the following expression row1.input.replaceAll(",", " ") then follow this explication https://community.talend.com/t5/Design-and-Development/String-Handling-in-Tmap/m-p/141342#M87305

 


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

@TRF,

 

But I am getting the output like below which is not expected

tLogRow_2 |
|=-------------=|
|FullName |
|=-------------=|
|smith john |
|taylor mary A |
|jhonson david |
|joseph j walker|
'---------------'

.---------+----------+--------.
| tLogRow_3 |
|=--------+----------+-------=|
|FirstName|MiddleName|LastName|
|=--------+----------+-------=|
|taylor |mary |A |
|joseph |j |walker |

Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

@muralam share your tMap


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

1.JPG2.JPG3.JPG4.JPG

kindly help attached is the job i tried to get output as expected but i am not able to figure where the issue is exactly

Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

Try the with the proposed solution


TRF
Seven Stars

Re: extract fullname to firstname and middlename and lastname

@TRF,

Thanks for the response, i got the expected result of course not completely

from the screen shot attached i have to handle

if LastName length =1(means LastName is single letter) assign LastName to MiddleName and MiddleName to LastName, could you please help with this issue am i missing something

FirstName|MiddleName|LastName|
|smith | |john |
|taylor |mary |A |
|jhonson | |david |
|joseph |j |walker |
Expected Result is like below

FirstName|MiddleName|LastName|
|smith | |john |
|taylor |A|mary|
|jhonson | |david |
|joseph |j |walker |

kindly suggest

 

Regards,

Meena

 

Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

You just have to check the last part length to decide if you have to get the middle or the last part to populate the lastname:

Capture.png

Here is the result:

[statistics] connecting to socket on port 3468
[statistics] connected
.---------------+------+------+------.
|             tLogRow_1              |
|=--------------+------+------+-----=|
|fullname       |first |middle|last  |
|=--------------+------+------+-----=|
|Smith,john     |Smith |john  |null  |
|James,Jones K  |James |K     |Jones |
|Joseph J Walker|Joseph|J     |Walker|
'---------------+------+------+------'

[statistics] disconnected

Thank's to mark you case as solved (Kudos also accepted as a bonus).


TRF
Highlighted
Fifteen Stars TRF
Fifteen Stars

Re: extract fullname to firstname and middlename and lastname

@muralam, thank's to mark your cas as solved


TRF

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch