Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Comparing SYSDATE

  1. #1

    Default Comparing SYSDATE

    Not that familar with Java scripting...sorry.
    Looked on the forums to create the script below.
    Why do I get a "SYS_DATE is not defined" error ?

    var
    sysDateJava = SYS_DATE.getDate();

    var
    EndDate = str2date(Assignment_End_Date, "m/d/yyyy");

    if
    (EndDate < sysDateJava)
    {
    Process.setValue(
    "N")
    Result.setValue(
    "Expired")
    }


  2. #2
    DEinspanjer Guest

    Default

    Is that a field in your stream? I think we need to see the transformation to help.

  3. #3

    Default

    Basically looking to compare a field in my stream (Assignment_End_Date) to todays date.
    Assignment_End_Date is a string in the format m/d/yyyy (1/1/2008)

    can I use this for todays date ?
    var today = new Date("<%=sysdate%>");

    How do I compare afterwards ?

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

    Default

    NO you can't use that construct.

    For the original post:
    1) is SYS_DATE in the stream... and exactly as that... sys_date e.g. is not the same as SYS_DATE
    2) is compatibility off in the dialog.

    Regards,
    Sven

  5. #5

    Default

    I'm able to get the system date by using this....

    var
    todayx = new Date();

    var
    today = date2str(todayx, "yyyyMMdd");

    if
    (today < "20080814")
    {
    Process.setValue(
    "N")
    Result.setValue(
    "Expired")
    }
    If I change the date to 20080815 everything changes, which is what I want.

    Now I want to compare to it with the Assignment_End_Date in my stream.

    var endDate = str2date(Assignment_End_Date.getString(),"M/d/yyyy");

    Why am I receiveing the following error ?
    Could not apply the given format on the string


  6. #6

    Default

    Got it to work.
    Had to change my Assignment_End_Date to a Date field using Select Values.

    Then....

    var xday = new Date();
    var today = date2str(xday, "yyyyMMdd");
    var xDate = (Assignment_End_Date.getDate());
    var endDate = date2str(xDate, "yyyyMMdd");
    if (endDate < today)
    {
    Process.setValue("N")
    Result.setValue("Expired")
    }

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.