Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Adding one day with calculator not behaving properly

  1. #1
    Join Date
    Feb 2017
    Posts
    2

    Default Adding one day with calculator not behaving properly

    Hello fellow forum users,

    I must be missing something obvious here.
    I am using the calculator step to add one day to a date value and loop over some data.
    My logic looks something like this:

    Name:  ok.jpg
Views: 295
Size:  28.2 KB

    Namely - we generate some data (data grid), we convert it to a date string, add a constant and then add this constant to the date field.
    This method works all fine, until we get to the date of '2015-12-26'. Then it adds one year and one day, instead of only one day:

    Name:  not_ok.jpg
Views: 266
Size:  25.0 KB

    Can anyone please explain why do I get this behavior from PDI? Is this a bug or am I missing something?
    If it matters - I am using version 7.1.0.0-12 of PDI

    I am attaching a sample .ktr for your reference.

    Thanks in advance!
    Attached Files Attached Files
    Last edited by raitchev; 12-02-2017 at 09:08 AM.

  2. #2
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    That's not what I see on my machine.
    I used the same Kettle version.

    PS: I suspect the loop you mentioned to be responsible for the final result ...
    Attached Files Attached Files
    Last edited by marabu; 12-02-2017 at 05:18 PM.
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Feb 2017
    Posts
    2

    Default

    Something must be wrong with my machine then. I ran your sample and I get the same result...:

    Name:  not_ok2.PNG
Views: 170
Size:  14.4 KB

  4. #4
    Join Date
    Nov 2009
    Posts
    688

    Default

    I got the same error as Raitchev. But when I change the conversion mask in the Calculator step the result is correct. Also when I change the conversion mask back to the original value the transformation is getting the correct results.

  5. #5
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    First of all, I made a typo: The date format specified in Calculator (YYYY-MM-dd) should have been yyyy-MM-dd.
    The good news is, it's definitely no error in the Calculator step.
    It's a presentation thing and the field value is still correct, i.e. 2015-12-27.
    So, no worries if you are using that field to configure a prepared SQL statement.
    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2009
    Posts
    688

    Default

    Ah stupid that I did not notice that

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.