Hitachi Vantara Pentaho Community Forums
Results 1 to 14 of 14

Thread: Problems with mathematics

  1. #1
    Join Date
    Sep 2007
    Posts
    14

    Default Problems with mathematics

    Hello to everyone.

    I need to ask a very newbie question.

    I'm using JavaScript for reduces two vaules. But when I do it a data preview the value appears a NaN.

    My script is the following:

    var X
    var Total_X
    var Y
    var Total_Y

    MV_Diff= (Total_X-Total_Y)

    And the script dosen't work.

    I try to calculator step, but this step don't generate the columns that I need after, and also if I put all my columns in the Step, the calculator forces to me to do it an operation of the another values.

    Can anyone help me with this?

    Thanx in advance!

    Regards

    Gonzalo

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

    Default

    Attach your transformation and maybe a small input sample... and you don't have to "var" any data coming on as field in a row.

    Regards,
    Sven

  3. #3
    Join Date
    Sep 2007
    Posts
    14

    Default sample

    Thx for the quick answer. I'm going to put a attached example.

    The idea is create a new column with name MV_Diff, and calucate the operation in the same JavaScript. is allright?. If you need more examples, please let me know.

    Thx in advance.

    Regards

    Gonzalo
    Attached Images Attached Images  

  4. #4
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    That should be working even though, as Sven said, you don't need to "var" the variables that come as fields from previous steps.

    Are you sure you're referencing the fields correctly? You can use the "Campos Inserción" button to see what you're getting from the previous step.

  5. #5
    Join Date
    Sep 2007
    Posts
    14

    Default

    tdidomenico you speak spanish?

    If I press the button "campos inserción" and the values appears (data1.getString; , for example) the script don't compile. and the ETL process abort.

    Help me please!

    Thx!

    Rgads

    Gonzalo

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

    Default

    The getString() only works if you have compatibility switched on, else you're using the actual value itself already... AND remove the var's which are already in the input row.

    Regards,
    Sven

  7. #7
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Yes, I speak spanish.

    "data1" would be the variable you're looking for.

    I would start by removing everything from the script and clicking on the "Campos Inserción" button. Because of what Sven wrote on the previous message, you should write something like:

    res1 = data1 - data2;

    without the getString/getInteger or whatever you're getting.

    After doing that, click on the "Obtener Variables" button, and you should be passing "res1" to the next step...

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

    Default

    Here you go

    Regards,
    Sven
    Attached Files Attached Files

  9. #9
    Join Date
    Sep 2007
    Posts
    14

    Wink

    Thax to you guys!

    I'll try it!!!

    Regards!

    PD: If I have a trouble I scream for help!


    Regards!


    Gonzalo

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

    Default

    If anyone of you wants to improve the Spanish translation in PDI, you can scream as well ;-)
    I have a nice GUI to translate, it's very easy.

    And now.... ¡Dos cervezas, por favor!

    ;-)

    Matt

  11. #11
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    I could work on the spanish translation.

    Should I follow the info on the "i18n made easy" message you posted on the list, or is there anything else I should know?

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

    Default

    Nope, that's it. It seems to be fairly straightforward. fr_FR is nearly done and I have done a chunk of nl_NL so far.
    Great to have you on board! Let us know if you need help.

    Matt

  13. #13
    Join Date
    Jul 2007
    Posts
    1,013

    Default

    Glad to be on board. I'll let you know if I'm in trouble

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

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.