View Full Version : Errors in Calculator Step

kettle_anonymous

04-10-2006, 10:52 PM

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!

MattCasters

04-10-2006, 11:41 PM

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

kettle_anonymous

04-11-2006, 05:00 PM

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-

MattCasters

04-11-2006, 10:20 PM

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

MattCasters

04-12-2006, 01:24 AM

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