In this article we will take a look at how to create some complex routing conditions for a Pentaho Data Integration (Kettle) job.
Out-of-the-box Kettle comes already with several easy to use conditional job entries:
We will look at a very trivial example:
In this job flow we only want to execute the Write To Log Sunday job entry if the day of the week is a Sunday. On all other days we want to execute the job entry Write to Log.
Note that you can write multiple lines of code, but you must make sure that the return value is a boolean value!
var d = new Date();
var dof = d.getDay();
dof == 6 ? true : false;
Running this ETL process on a Wednesday will show the following in the log:
More information about this job entry can be found on the Pentaho Wiki.
You can download the sample job file from here. This file was created in PDI 4.4 stable, which means that you should only open it in PDI 4.4 or newer.