Saturday, May 15, 2010

How to Split a String in pentaho Kettle

0 comments
To get values from a comma separated string we can spilt it in following way.
In the design mode drill down the Scripting folder drag and drop the  Modified Java Script Value step
image
Double click the the icon  and go the java script value Text area, copy the below code and past it into the Script Value Text Area
var employee = EmployeeInfo.getString().split("\\,");
var ID = employee [0];
var  Name= employee [1];
var Address = employee [2];
image
here in this code of java “var” is the reserved word for declaring String variables while “ID”,”name”,”address” are the names of variables that will hold the values after splitting and the EmployeeInfo is the String that contains the ID, Name and Address in the form i.e. 1234,Ali,pakistan

0 comments: