Search code examples
sftppentaho

Passing dates as parameters in a Pentaho SFTP step


How can I pass the current date formatted as YYYYMMDD to a SFTP file transfer in a Pentaho Kettle Job? I have the below job running correctly in Pentaho CE It connects to an SFTP and pulls the zip file with the date 20150924 I want this to be dynamic for automation, always pulling the current date on each run.

enter image description here

I made the below transformation, it pulls the current date as ‘Tdate’ How do I use my Tdate from the transformation as a parameter (or another way) in my job. enter image description here

I’ve tried a few variants but just haven’t got this to link up right / used the right steps/code Any help greatly appreciated, Thanks


Solution

  • Do you see the dollar sign ($) beside the file name in the 'Wildcard' field? That means you can use a variable for that field. Set a parameter in the job (probably called TDATE) and use the Set variables step in your transform (instead of Copy rows to result) to initialize the value prior to the Get a file with SFTP step.

    PS, you could also use a JavaScript step to set the variable, but I prefer not to break the visual paradigm.