Pentaho Tools :

Pentaho C-Tools(CDE,CDF,CDA),Pentaho CE & EE Server,OLAP-Cubes,Analysis using Pivot4J, Saiku Analytics, Saiku Reporting, Ad-hoc Reporting using Interactive Reporting Tool,Dashboards,Reports using PRD, PDD,Data Integration using Kettle ETL,Data Mining usign WEKA,Integration of Servers with Databases,Mobile/iPad compatible Dashboards using Bootstrap Css,Drilldown dashboards,Interactive Dashboards

Thursday, 20 August 2015

Pentaho Data Integration use case : add value fields changing sequence and Java script concat & indexOf methods usage

This post is based on a thread posted in pentaho community forums.

Link :

Problem Statement :
Add row numbers to child values of a filed. ( the first field in the image is the input )

Solution :

Java script : 

var res = field.concat(seq); // con-cat the "field" column with "seq" column.

var indexOfParentValue=res.indexOf("ParentValue"); //identify the "String position" and returns 0 or -1

if(indexOfParentValue ==0){
var finalField=field;
var finalField= res;

NOTE that compatibility mode is un-checked in MJavaScript Step.

Download : Download example here

I hope this helps - how to write java script methods in Kettle ETL.

- Sadakar Pochampalli

No comments:

Post a Comment