2

I'm a beginner with pentaho data integration and I want to split a string with the following form : FIRSTNAME LASTNAME CODE I want to isolate the firstname and lastname from the code noting that the lastname can contain more than a word. I thought about spliting all the string based on space separator but the problem is that the name can sometimes be composed of more than two words. Can you show me please the steps to follow to acheive that?

Zakaria Belghiti
  • 521
  • 3
  • 8
  • 19

1 Answers1

2

Split the rows with Step "Split Fields". Then concatenate the fields for lastname1 or lastname2OrCode if person has 2 last names, otherwise set the code field.

Kettle-Transformation Data grid content Field Spliter

And this simple Javascript (Do not forget to click at Get variables)

var lastname;
var code;

if(codeTmp==null){
code = lastname2OrCode;
lastname= lastname1;

}else {
lastname = lastname1+ " "+ lastname2OrCode;
code = codeTmp;
}

results

maloku
  • 153
  • 1
  • 7