Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: SFTP put with date in filename

  1. #1
    Join Date
    Nov 2011
    Posts
    3

    Default SFTP put with date in filename

    I have a job that calls a transformation that uses a database input and a text file output. The text file contains the date in the form of mmddyyyy.

    How can i get the SFTP put step to look for the date in the filename?

    The put step works fine if i use a wildcard. But i want to be able to uniquely identify which file to submit to the SFTP since this job will be run daily?

    Any thoughts?

    Thanks

  2. #2
    Join Date
    Apr 2007
    Posts
    2,010

    Default

    you need to use a variable for your filename. use a get system info, and a select values step and a set vars to set your variable to the right format.

  3. #3
    Join Date
    Nov 2011
    Posts
    3

    Default

    So would the flow of the transformation would be this then?

    table input -> get system info -> select values -> set variables -> text file output

    I am new to kettle, How would I use a variable for the filename?

  4. #4
    Join Date
    Sep 2011
    Posts
    190

    Default

    You can use ${VARIABLENAME}

  5. #5
    Join Date
    Nov 2011
    Posts
    3

    Default

    All of that makes sense but how do I get kettle to get the system date and store it in a variable?

  6. #6
    Join Date
    Sep 2011
    Posts
    190

    Default

    Make one job and two transformations, so that the job calls the first transformation before the second

    In the first transformation do
    : Get System Info -> Set Variables
    In the Get System Info step add a column of System Date (fixed) or something similar
    In the Set Variables step the columns can be converted to a variable
    Optionally you can add a step in between these two steps to format the date so that it suits you better

    In the second transformation you can then reference this variable using ${VAR}

    The reason why this must be done in two transformations, is that the executionorder of steps within a transformation is dynamic, and thus there's a risk of accessing the variable before it is instantiated.
    Last edited by mbvt; 11-18-2011 at 09:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.