Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Javascript setting integer

  1. #1
    Join Date
    Jan 2009

    Default Javascript setting integer


    I am trying to loop over all the fields in a row, and modify the value of each integer field.

    I have :

    var STORE_NUMBER = 1234;

    for (var i=0;i<getInputRowMeta().size();i++) {

    if(row[i] > (STORE_NUMBER * 10000000000)) {

    row[i] = (parseInt(parseInt(row[i]) + 10000000000));


    The type of the field is Int, but whatever i do, the value is inserted as a double. Functions such as getInteger(), .plus() etc do not seem to work for me ...

    Any pointers would be great.


  2. #2
    Join Date
    Nov 1999


    That is the reason why we don't really advice people to change the row directly using JavaScript.
    JavaScript is using dynamic data types a.k.a. weakly typed.
    As such, you never know for sure what kind of data type you get in return.

    This has caused major havoc with the setValue() methods in v2.x.

    In any case, you could try with a bit of Java code:

    row[i] = lang.Math.round( row[i] + 10000000000);
    At least in Java you have strict data types ;-)



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.