Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: How to create a Transformation Parameter like a curdate() sql command?

  1. #1

    Default How to create a Transformation Parameter like a curdate() sql command?

    I need to make a parameter that is equal to current date (YYYYMMDD) but Internal.Kettle.Build.Date its in the Date and Time format.

    My goal is to create an output where its name its like BD_CATEG_(parameter) where parameter = curdate().

    Thanks,

    Manuel

  2. #2
    Join Date
    Apr 2008
    Posts
    1,771

    Default

    Hi
    You can use select value step to change the format from date to string, then cut string and use that to create your parameter.
    -- Mick --

  3. #3

    Default

    Can you explain me how can I after editing the metadata in the select value step create the new parameter ?

    Thanks

  4. #4
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by manuel.paredes View Post
    My goal is to create an output where its name its like BD_CATEG_(parameter) where parameter = curdate().
    What kind of output?
    Most of the file output steps include an option for "Include Date in Filename" that you can format.

  5. #5

    Default

    hi gutlez

    What you said worked very well, thanks a lot

    By the way is there anyway to change Internal Kettle Date into an Integer value? Select Values isn't working for me
    Last edited by manuel.paredes; 11-10-2015 at 02:29 PM.

  6. #6
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by manuel.paredes View Post
    Internal Kettle Date into an Integer value
    Which "internal kettle date"?
    If you mean Internal.Kettle.Build.Date, then it is a string that needs to be parsed into a date first. However that is the date that your copy of kettle was built, not the current date, nor the date that the transform was built. Not something particularly useful.

  7. #7

    Default

    It's easier if I tell you what I need.I need to create a new variable called dataproc as its name says its the execution date of the procedure like if it was runned today it should be given like 20151111 can you help me with that ?

    I know probably that I need to Get System Info but I can't parse a Today 00h00m to a 20151111

  8. #8
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Quote Originally Posted by manuel.paredes View Post
    My goal is to create an output where its name its like BD_CATEG_(parameter) where parameter = curdate().
    What I'm reading from this is that you want to create a file (of some sort) called BD_CATEG_YYYYMMDD.ext where YYYY is year, MM is month, DD is day, and .ext is the type.

    In the Text File Output step, you can name the file: /path/to/BD_CATEG_
    In the extension field, you can put the correct extension (txt or csv)
    There is a check-box a little bit further down saying "Include date in filename?" ... Check it.
    There is a check-box a little bit further down saying "Specify date time format?" ... Check it.
    The field "Date Time Format" will now be enabled. Enter "YYYYMMDD" (without the quotes) in this newly enabled field.

    When you run it, it will create a file /path/to/BD_CATEG_20151116.txt which is what you've been asking to do. No Variable required.

    If you tell us what you *ACTUALLY* want to accomplish, we can help you. If you tell us how you want to accomplish it, we probably can't.

Tags for this Thread

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.