Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: JavaScript ReferenceError accessing input field

  1. #1
    Join Date
    Jan 2008
    Posts
    18

    Default JavaScript ReferenceError accessing input field

    Just trying to access a simple varialble's value. When I "Test Script" on the Javascript step, I get a dialog with:
    Test failed
    Unable to get fields from the previous steps because of an error
    General error executing script:
    ReferenceError: "startdt" is not defined. (script#1)
    and details were:
    org.pentaho.di.core.exception.KettleException:
    General error executing script:
    ReferenceError: "startdt" is not defined. (script#1)

    at org.pentaho.di.ui.trans.steps.scriptvalues_mod.ScriptValuesModDialog.test(ScriptValuesModDialog.java:1103)
    at org.pentaho.di.ui.trans.steps.scriptvalues_mod.ScriptValuesModDialog.access$300(ScriptValuesModDialog.java:128)
    at org.pentaho.di.ui.trans.steps.scriptvalues_mod.ScriptValuesModDialog$4.handleEvent(ScriptValuesModDialog.java:461)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.trans.steps.scriptvalues_mod.ScriptValuesModDialog.open(ScriptValuesModDialog.java:555)
    at org.pentaho.di.ui.spoon.delegates.SpoonStepsDelegate.editStep(SpoonStepsDelegate.java:124)
    at org.pentaho.di.ui.spoon.Spoon.editStep(Spoon.java:6433)
    at org.pentaho.di.ui.spoon.trans.TransGraph.editStep(TransGraph.java:2153)
    at org.pentaho.di.ui.spoon.trans.TransGraph.access$100(TransGraph.java:116)
    at org.pentaho.di.ui.spoon.trans.TransGraph$4.mouseDoubleClick(TransGraph.java:312)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
    at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at org.pentaho.di.ui.spoon.Spoon.readAndDispatch(Spoon.java:873)
    at org.pentaho.di.ui.spoon.Spoon.start(Spoon.java:5639)
    at org.pentaho.di.ui.spoon.Spoon.run(Spoon.java:5735)
    at org.pentaho.di.ui.spoon.Spoon.main(Spoon.java:371)
    Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "startdt" is not defined. (script#1)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
    at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3292)
    at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1570)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3162)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
    at org.pentaho.di.ui.trans.steps.scriptvalues_mod.ScriptValuesModDialog.test(ScriptValuesModDialog.java:1036)
    ... 21 more
    test.csv (not sure why i can't attach this file) =
    Code:
     id,name,workdate,startdt,starttime,enddt,endtime,sequence,company,dept,location,item,WIP,shift,class
    1234,Billy Bob,6/4/2008,6/4/2008,06:00,6/5/2008,14:30,1,Bingo Slots,6110,Bandit,000175,654410,2,30
    Attached Files Attached Files

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

    Default

    It's a known problem... there's also a JIRA open for it... don't test, just run

    The problem is that when you press "test" the step does not have a valid input row (so it makes its own) and the variable environment is just a dummy environment (as the real environment is only known at runtime).

    Regards,
    Sven

  3. #3
    Join Date
    Jan 2008
    Posts
    18

    Default

    thanks for the info. makes sense. just so bad at JS that i want to test by bad syntax first.

    searched forums, but didn't check bug system. will do first next time.

    thanks again.

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.