Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: file names as regular expressions

  1. #1

    Default file names as regular expressions



    hii again
    i don't know is that also mind reading or it is possible in kettle

    actually i wanna to make transformation , from text file to text file or whatever , "just for first trial"

    and i don't have fixed file name , it's variable based on date

    it's name , like the current date
    for example 05-07-2009.txt

    i specified the directory in input step and that regular expression

    (0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)[0-9]{2}


    actually iam not good with regular expressions , i got it via internet and i made online tests on 05-07-2009 , and it was correct

    but actually it doesn't work in kettle, when getting fields from input step , it tells me to check directories , files and expressions

    actually i checked them and nothing wrong in my thought

    am i doing the right steps or it is not possible or what is the wrong

  2. #2

    Default

    simply enter 05-07-2009.txt as wildcard.

    Samatar
    Samatar

  3. #3

    Default

    first thanks for your reply

    second, actually the file name is not fixed , it's variable
    so i can't enter 05-07-2009.txt directly in the wild card

  4. #4

    Default

    OK
    You have to solutions :
    1- use variable in wildcard
    2- get wildcard in a dynamic way (>=PDI 3.2)

    Samatar
    Samatar

  5. #5

    Default

    could you explain more please

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    lol ... add \.txt to the end of your expression and it will be ok.

    Also in text file input your directory/regular expression needs to be in the "selected files" table in the dialog (hint: press the add button after filling in directory/wildcard).

    Regards,
    Sven

  7. #7

    Default

    Gentlemen,

    I think the original poster is asking how would he get today's date as an expression. ie. say how do we get the exact string 090930 or 09302009 as a part of the file name.

    there could be several other files in the location which have .txt as extension. but this user just wants to download that day's file. in this case, that day's date is the file name, in which case, we need to fill in the date(plus any additional constant chars) as file name.

    If you don't know the answer atleast don't confuse please.

  8. #8
    Join Date
    Feb 2009
    Posts
    296

    Default

    The question is rather old by now. But for the record:
    we use a transformation that set a variable "startdate".

    The transformation uses a Get System Info step to calculate the current date. It also checks for a parameter so we can manipulate that date and reload stuff from last week.

    That variable "${startdate}" is used in another transformation later on.
    Fabian,
    doing ETL with his hands bound on his back

  9. #9

    Default

    A question fabian

    Say i have a job, not a transformation.

    A step in my job needs a parameter/variable as an input, how do i do this ?

    I mean, I can make add a transformation as a step in my job and s you said in your example, i can set a variable in a Transformation but how do i pull it(variable) out ? I mean out of a transformation.

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.