Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Errors in Calculator Step

  1. #1
    Join Date
    Sep 2005
    Posts
    1,403

    Default Errors in Calculator Step

    Please help me. I am having problems with the calculator step.
    I used it successfully but sometimes, I just cannot explain what is the error.

    I am trying to Divide A with B

    A1 = A / B

    A = 30
    B = 360
    The error is "Unexpected error in Processing Function [ A / B ] for field A1

    I also tried doing an addition, so it would look like this.

    A1 = A + B, but still, there is the error.


    The list of calculations in the step calculator is this...

    A0 = A + B (works ok..)
    A1 = A / B (the error goes here)

    What do you think is the problem?

    Thanks!

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

    Default RE: Errors in Calculator Step

    Hi,

    What is the complete error and can you check the data-types of A and B?

    A * B works fine on a Numeric values OR Numeric and String. (3 * "A" = AAA")
    A + B works fine on Numeric values OR Strings: "A"+"B" = "AB", ...

    A / B ONLY works on Numeric values, but the exception throws in that case should tell you this.

    Mmm, I should make a Weekly Tip out of this ;-)

    Perhaps there is another error going on here(Devision by 0, etc), but you really should post the complete error log.
    Also, people, don't hesitate to file bug reports for these!

    Thanks in advance!

    Matt

  3. #3
    Join Date
    Sep 2005
    Posts
    1,403

    Default RE: Errors in Calculator Step

    Okay, I realized that I cannot use values ( like 3, 3.4 or 0 ) DIRECTLY in the calculator. I noticed that it worked when all of the values where represented by a field.

    This is how it should look like

    TABLE -> ADD CONSTANTS -> CALCULATE

    in the ADD Constants, we added the values like 3.14 represented by a field name like PI, and in the CALCULATE step, we used the PI field name.

    If we used the 3.14, then there will be an error!

    Hope this will help everyone using the CALCULATOR step.

    -Cholo-

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

    Default RE: Errors in Calculator Step

    Perhaps you need to specify it as "3,14" in stead of "3.14" ?
    Note that you CAN specify the decimal point in the Constant step.

    A preview works wonders to see what value leaves the constant step.

    Matt

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

    Default RE: Errors in Calculator Step

    Also, please note that you can also add constants in Calculator. (Set field to constant value A) You can then opt NOT to take this field with you to the next steps by setting the "Remove flag" to Y.

    I did think about allowing constants to be used directly into "Field A", "Field B", ... positions but it would make it impossible to verify the correcness of the calculations. Making mistakes would become very easy. After all, it's not against the Kettle rules to have a field called 3.1415 etc.

    Later, when more complex widgets come available, we can perhaps improve the concept. For now the current system will have to do.
    Any tips are always welcome ofcourse.

    ;-)

    Matt

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.