Pentaho

 View Only

 How to run a PDI job from a CDE dashboard button

  • Pentaho
  • Ctools
  • Pentaho
Marvin Horst's profile image
Marvin Horst posted 10-02-2019 17:44

We had a need to allow users to run a PDI job from a CDE dashboard button. Thought I'd share my solution in case others find it useful.

 

Javascript code implementing the Jobs REST API was used. Our Pentaho Server is CE 8.0 and the functions are provided as a requirejs javascript resource file.

 

Just add the attached file as a CDE resource and the following code into the button Expression property of your CDE dashboard.

function f() { /* exec_job(this, pdi_job, blockui) pdi_job - full path to the job in the repository blockui - set to true and the user sees the spinning wheel until the job is completed. */ pdi.exec_job(this,"/public/pdi/PaulB/Update Cycle Counts daily",true);  /* if blockui is true you can modify the polling behavior with the following function calls.  pdi.setPollInterval(milliseconds) - sets the wait period between each polling rest call. defaults to 10000 milliseconds pdi.setMaxTimeoutSec(seconds) - sets the maximum time the user will be blocked out of the UI. defaults to 300 seconds */

You will need to update the carteCred and url variables in the code to match your server setup.


#Ctools
#Pentaho
Yannick LE PON's profile image
Yannick LE PON

Hello

I use BA server ce 8.3 and pdi ce 8.3

I add CDE resource file runPdiJob and function into the button Expression

I don't understand "pdi.exec_job"

Name of CDE resource must be "pdi"?

Can you help me?

regards

Marvin Horst's profile image
Marvin Horst

Yes that's what I named the resource in Layout. If you named it something else like myname then just change pdi.exec_job to myname.exec_job

Marvin Horst's profile image
Marvin Horst

After moving to another server I realized some changes would be helpful to make the code more maintainable .

url: "https://my_server:8080/pentaho/kettle/",

should be changed to

url: "/pentaho/kettle/",