DERIVED VARIABLES IN PENTAHO

Today, i will discuss about the Derived variables in Pentaho. The term “Derived Variables” means variable name or variable value derived from a particular variable or its value. In order to demonstrate that i have designed an ETL job for the same. See the below image for the same.

In this  transformation, i used get system info, where i defined one variable “date_value” with value as system date (fixed). After this component, i added Java script component where i  created new more variables and value is  derived from date_value variable. See the below image for the same.


MMT - DF [CPS] IN
As you can see in above image, i have set three more variables which  will tell year,date and week number. As these variables values are derived from existing variable value, hence these are called derived variables in Pentaho.  In “Select  values” component, change the data type to Number for all derived columns and set the format as “#”. Below are the logs post execution of the transformation.

Write to log.0 – ————> Linenr 1——————————
Write to log.0 – date_value = 2018/06/04 14:33:34.393
Write to log.0 – Year_var = 2018
Write to log.0 – Week_var = 23
Write to log.0 – day_var = 4
Write to log.0 –
Write to log.0 – ====================

Related posts