Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: What is javascript compatibility mode?

  1. #1
    Join Date
    Mar 2008
    Posts
    11

    Default What is javascript compatibility mode?

    According to the FAQ, non-compatible mode exposes java objects directly and is the preferred mode for new javascripts but:
    • why is compatibility mode on by default?
    • why can't I set a value in non-compatible mode?
    I'd like to use non-compatible mode but:
    works: var a = COL1
    does not work: COL1 = "new value"

    In fact the only way I've found to set a value is by using row[x]="new value" which is a little ugly. In non-compatible mode, the "Output Fields" on the left are like in compatible-mode ie COL1.setValue(var) but if you try and do this in the code, the javascript does not compile (test script fails, as does running the transfo)!! (There is an open bug that might be the same problem although it's worded differently)

    Plus there seem to be other bizarre differences btwn compatible and non-compatible javascript.

    Can someone explain things (and maybe update the FAQ at the same time )

  2. #2
    DEinspanjer Guest

    Default

    You certainly don't have to use row[x] = "new value". Just use var new_value = "new value" then assign new_value to a new output field below.

    It defaults to compatible because they didn't want to break backward compatibility with old scripts.

    The non-compatible mode performs better because it doesn't have to go through the large and complicated value type conversion routines required to be able to set values to existing fields. This is the trade off.

    If there bizarre differences, they should be questioned in detail in the forums or reported as Jira bugs.

  3. #3
    Join Date
    Mar 2008
    Posts
    11

    Default

    If I use 'var new_value' like you say, then I need to follow the js step with a "select values" step to replace the original value with 'new_value'. I would have thought there would be a way to do it all in javascript. One can set values in the old mode after all. But maybe this is one of the trade-offs with the new mode? No more setting values in js?

    As to your second point about compatibility--I could see old scripts being marked as backwards compatible, but if I create a new javascript step, I would have thought putting 'backwards compatible' to false would help people move towards the new system. From personal experience, I've only recently realized there are two js modes and I now have 30+ transformations all of which were written in the old format. Maybe I'll create a 'suggestion' jira.

    Actually I find that javascript behaves bizarrely in general and so the problem may not be attributable to 'compatibility' but you're right, the best I can do is create jiras as I can define them.

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    FYI, some information on the differences:

    http://wiki.pentaho.com/display/EAI/...2.5.x+to+3.0.0

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.