Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: String to Date Format Issue

  1. #1
    Join Date
    Feb 2011
    Posts
    3

    Post String to Date Format Issue

    Hi

    i am new to PDI.I have a csv file input with one column Project EndDate as string 9 (dd-mmm-yy). I want to calculate date difference ie Current Date - Project EndDate. i am using Formula but while executing the transformation, it throws an error like

    org.pentaho.reporting.libraries.formula.parser.FormulaParseException: Encountered "<EOF>" at line 1, column 0.
    Was expecting one of: <UNSIGNED_INTEGER>
    Can you please help me with this

    i have turned off the lazy conversion. i tried using the Select values but it gave an error that it couldnt convert the string to date

    Thanks
    Suchitra

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

    Default

    Hi Suchitra,
    I think that you could simply define that field as "Date" and apply the correct mask when you define the fields in the Text File Input.

    Mick

  3. #3
    Join Date
    Feb 2011
    Posts
    3

    Default

    Hi Mick
    i tried that also.it didnt preview any rows. now i tried again with Select values. its working fine in that but i am using formula after that. its giving me an error.
    few related doubts
    1) how to get current date in Formula?
    2)how to find date difference ?
    3) what is the date format in PDI?
    4)can we use cast or convert fn in Formula in PDI?

    Thanks
    Suchitra

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

    Default

    Hi Suchitra.
    When you use "Text File Input" step, you should be able to preview the data, before you define fields and formats and after that.
    Once you have defined your fields, do a preview and check if the "Date" field looks fine.
    In your Date field, in Format try: "dd-MMM-yy" and check that PDI can read those records without any problem.
    1. I would use a Javascript to create a new field called TodayDate.
    2. Instead of Formula, I would use "Calculator" step. There a "Calculation" called "Date A-Date B in days". You can use your Date in combination with the new TodayDate field.
    3. PDI can use different date formats.
    4. Don't know, but I would not use that step.

    Hope it helps.
    Maybe you can attach few lines of your text file?

    Mick

  5. #5
    Join Date
    Nov 2008
    Posts
    143

    Default

    Instead of Javascript, use Get System Info for the Current Date issue.

  6. #6
    Join Date
    Feb 2011
    Posts
    3

    Default

    Hi
    I used SelectValues to change the date format and a Java Script to calculate the date difference. Now everything is fine.

    Thanks
    Suchitra

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.