Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: perform delta updates on based on timestamp in the source database

  1. #1

    Default perform delta updates on based on timestamp in the source database

    Hi,

    Quite new to SPOON and KETTLE.
    My requirement is to do delta updates on based on timestamp in the source database.
    For this i would need to compare the timestamp of the source table(one row in source table) and timestamp of my last run job.
    If the timestamp of my source table is higher than the last job run time, then I update the table, else I do not update.

    For implementing this, i have 2 'table inputs' feeding in to a 'modified java script' where the timestamp comparison happens.

    The 1st 'table input' extracts the timestamp from source table as "date1"
    and
    the 2nd 'table input' extracts the timestamp from a table which stores the last time that job was run as "date2".

    I have connected input 1 and input 2 to the 'modified java script' using hops; i.e 'table input 1' hops to 'table input 2' which hops to the modified JS.

    Inside the 'modified java script' I am now able to see both the variables(DATE1 and DATE2) on which i need to perform the comparison.

    But now while running the transformation in debugging mode, I am getting the error
    Unexpected error :
    org.pentaho.di.core.exception.KettleValueException:
    Javascript error:
    ReferenceError: "DATE1" is not defined. (script#4)

    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.addValues(ScriptValuesMod.java:436)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.processRow(ScriptValuesMod.java:667)
    at org.pentaho.di.trans.step.BaseStep.runStepThread(BaseStep.java:2889)
    at org.pentaho.di.trans.steps.scriptvalues_mod.ScriptValuesMod.run(ScriptValuesMod.java:731)
    Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "DATE1" is not defined. (script#4)



    Let me know if there is something obvious that I am missing.
    Is there another method to feed the JS with values from 2 separate 'table inputs'?


    Let me know if you need any more information

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

    Default

    Just curious: Why don't you use a WHERE clause in your Table Input instead of a separate JS step?
    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.