How to extract first middle and last name?

 We have an input like the below Input File Data.

Joseph J Walker

Hari Jana Bramhaiah

Expected Output : like below split the FullName column into 3 different Columns



To extract first and middle last names we will use the below steps.

Step 1: Add the tFixedFlowInput component and configure it to get Input Data.

Step 2: Add the tMap component and connect with tFixedFlowInput using the Main link and do the following setting in it.

which looks like this

 

Var:

split_name Object = row8.full_name.replaceAll(",", "").split(" ")

first String =((String[])Var.split_name)[0]

middle String = ((String[])Var.split_name).length>=2?((String[])Var.split_name)[1]:null

last String = ((String[])Var.split_name).length>=3?((String[])Var.split_name)[2]:null 

Output:

full_name = row8.full_name

first = Var.first

middle = Var.last!=null&&  Var.last.length()==1?Var.last:Var.middle

last = Var.last!=null&&  Var.last.length()==1?Var.middle:Var.last


Step 3: Add tLogRow to check the result. you will see the output as below.