Friday, March 5, 2010

Setting and Getting varibles in Pentaho Transformations

0 comments
while working with the variables in pentaho Transformations one can select specific records in global and local variables with the help of SET VARIABLE AND GET VARIABLE available in the transformations

for example:
to get a record from source and then save it into SET VARIABLE there you can define the scope of the variable i.e. valid in root etc.. in the first column name the variable and then select the scope of the variable from the drop down combo box...


now for accessing the same variables' value in any where through the transformations and job what you need to do it take a GET VARIABLE from the menu and open it then in the first column name the variable and then access the same variable you declare in SET VARIABLE
with following style

SET Variable:

variable name Scope

my_variable Valid in root job only

GET VARIABLE::

new variable name declared variable name

my_new_name_for _variable ${my_variable} or %%my_variable%%

by default it is string but u can change the data type through introducing the SELECT VALUES from the menu .......go in the meta data and select the data type for the required Fields and retain the rest of the other fields in their own data types......................

0 comments: