Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
muralam
Creator
Creator

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

FirstName MiddleName LastName
John   Smith
James K Jones
Joseph J Walker

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

 

Regards,

Meena

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

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:

0683p000009M1IU.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).

View solution in original post

8 Replies
TRF
Champion II
Champion II

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

 

muralam
Creator
Creator
Author

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

TRF
Champion II
Champion II

@muralam share your tMap

muralam
Creator
Creator
Author

0683p000009M1bf.jpg0683p000009M1Xo.jpg0683p000009M0y1.jpg0683p000009M1bk.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

TRF
Champion II
Champion II

Try the with the proposed solution

muralam
Creator
Creator
Author

@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

 


6.JPG
TRF
Champion II
Champion II

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:

0683p000009M1IU.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
Champion II
Champion II

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