Passing parameters from parent job to sub job/transformation in Pentaho Data Integration (Kettle) -Part 1

Passing parameters from parent job to sub-job/transformation in Pentaho Data Integration (Kettle) – Part 1

Part -1 : Using setter and getter methods :

1.Set variables in parent job/transformation.
2.Get variables in sub-job/transformation.

1.Set variables :

Identify the field names that you are going to set using set variables step and assign each with a proper variable name.

And also define the scope of the variable with following possible options.

Variable Scope type :

1.Valid in the virtual machine: the complete virtual machine will know about this variable.
Warning: this makes your transformation only fit to run in a stand-alone fashion.
Running on an application server like on the Pentaho framework can become a problem.
That is because other transformations running on the server will also see the changes this step makes.

2.Valid in the parent job: the variable is only valid in the parent job.
3.Valid in the grand-parent job: the variable is valid in the grand-parent job and all the child jobs and transformations.
4.Valid in the root job: the variable is valid in the root job and all the child jobs and transformations.

Configure set variable step like below.


But please note that, IT IS NOT POSSIBLE TO SET AND USE A VARIABLE IN THE SAME TRANSFORMATION.This is because all steps run in parallel.

2.Get variables :

Use get variables step in sub-job/transformation to get the same information from the parent job/transformation.

But you need to make sure that you have specified the variable name in a correct format like ${variable}
or %%variable%% (as described in Variables). That means you can also enter complete strings in the variable column, not just a variable.

Configure get variables step like below.


So now you can utilize the same variables in your sub-job/transformation wherever required.

Apart from this,we can also pass all parameters down to sub-job/transformation using job / transformation executor steps.

Please follow my next blog for part 2 :
Passing parameters from parent job to sub job/transformation in Pentaho Data Integration (Kettle) -Part 2,






Most basic knowledge any new learner would have of word parameter -“ parameter is a limit or boundary which defines the scope of a particular process or activity ”. And technically we can define it as – “A numerical or other measurable factor forming one of a set that defines a system or sets the conditions of its operation. ” Or call it “filter” in simple words.

But in jasper-reports they represent the best way communication channel between the report engine and the execution environment (which is your application). After designing the report and checking its preview, what designer will provide as solution to the user for his desired criteria for report generation at run time, the answer is parameter. So, here are basic steps using which you can add parameters to your report to enhance its reporting experience for user. Add parameter to the report from report inspector, and manage its addition and removal from the report .

1Fig 1.1

Right click on the “parameter 1” as shown in Fig 1.1, and rename the parameter as per your convenience. Now, pay attention to its properties to modify it .

2Fig 1.2

In properties you will notice fields as shown in Fig 1.2 , after naming it and defining its class in “parameter class” which is basically its data type, you need to provide “default value expression ” which gets executed only when value of parameter is not provided by the user at run time. Check box of “use as prompt” for pop up to get value from user , which will appear as shown in Fig 1.3.


Fig: 1.3

Next question is how parameter gets executed in SQL query of report?


Parameters can be used in SQL queries to filter records in a where condition or to add/replace pieces of raw SQL or even to pass the entire SQL string to execute.

In the first case the parameters are used as standard SQL parameters, in example:
Syntax of parameter in query : $P{parameter1}
In above example the entered  value get evaluated to display the details of row containing values of DEPARTMENT_ID entered by user through parameter. Result will get displayed as Fig: 1.4
In this user will be solely responsible for the correct execution of report as only entered value will be used in the execution of query.

4Fig 1.4


Nisha Sahu