Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Maximum of two timestamp field

  1. #1
    Join Date
    Aug 2015
    Posts
    5

    Default Maximum of two timestamp field

    Hi everybody,

    I have two fields of type timestamp and need to get the maximum of the two.
    How can I do that? I tried the Calculator, the Formula step, and the Script step already without any success (error messages, or just no max() function available).

    So, how can I do it?

    Thanks for any help!

    Hendrik.

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

    Default

    Try with User-Defined-Java-Expression

    maxTS = ts1.before(ts2) ? ts2 : ts1

    or something more elaborated ...
    So long, and thanks for all the fish.

  3. #3
    Join Date
    Aug 2015
    Posts
    5

    Default

    Thanks for the quick reply.
    This is the error message I am getting now:

    2015/11/19 14:41:09 - User Defined Java Expression.0 - ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : Unexpected error
    2015/11/19 14:41:09 - User Defined Java Expression.0 - ERROR (version 5.4.0.1-130, build 1 from 2015-06-14_12-34-55 by buildguy) : org.pentaho.di.core.exception.KettleException:
    2015/11/19 14:41:09 - User Defined Java Expression.0 - org.pentaho.di.core.exception.KettleValueException:
    2015/11/19 14:41:09 - User Defined Java Expression.0 - org.codehaus.janino.CompileException: Line 1, Column 19: A method named "before" is not declared in any enclosing class nor any supertype, nor through a static import

    Could it be this issue: http://stackoverflow.com/questions/3...tamp-in-kettle?

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

    Default

    Sorry, I don't know - see my Kettle version in my forum sig?
    What about the workaround mentioned in the bug report?
    So long, and thanks for all the fish.

  5. #5

    Default

    User-Defined Java Expression currently doesn't work for Timestamps: http://jira.pentaho.com/browse/PDI-14347

    Aside from the other step options already recommended, the User-Defined Java Class, while a bit of a sledgehammer, would likely work as well.

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

    Default

    I've a feeling that it isn't only UDJE but every step utilizing Janino ...
    So long, and thanks for all the fish.

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.