Page 1 of 1

Multiplication with -1 in Transformer

Posted: Sun Mar 25, 2007 8:38 pm
by nkln@you
I have a i/p link variable A in transformer and I doing a derivation
as A*-1. (i.e i need to negate the vaue of A)

When value of A is 0.00999, A*-1 is giving result as 0. Whereas only A is giving , it is giving 0.00999.

Why am I getting a value of 0 when it is multipled by -1.

Any solution for this.

Posted: Sun Mar 25, 2007 8:54 pm
by nkln@you
I tried using -A. Still the output value is 0.

Posted: Sun Mar 25, 2007 11:43 pm
by Sreedhar
nkln@you

Can you please tell us what is the Data Type you have been using for the derivation(Target).

If you have you the appropriate data type then you should get the -ve value

I believe you are using an inappropriate data type so the solution is becoming as 0 (no precision added )

Posted: Mon Mar 26, 2007 12:01 am
by nkln@you
The datatype in database is number. In Transformer it is decimal, lenght =38, display=40

Posted: Mon Mar 26, 2007 4:59 am
by ray.wurlod
What data type are you using in DataStage? This behaviour might occur, for example, if you were using an unsigned numeric or an inappropriate scale value. Are any warnings logged?

Posted: Mon Mar 26, 2007 6:34 am
by chulett
Scale? Same thing happens if you multiply by +1, yes?

Posted: Mon Mar 26, 2007 1:31 pm
by nkln@you
Ray,

The datatype in Datastage is decimal whose lenght is 38 , display is 40, no value for scale. There are no errors or warnings in logs.



Chulett,

Yes, Chullet even when I multiplied with +1 it is giving a value of 0. Only when it is directly mapped, I am getting original values. This is wierd.

What's wrong with my code

Posted: Mon Mar 26, 2007 1:43 pm
by DSguru2B
Ill highlight Craig's suggestion, SCALE. Fix the scale.

Posted: Mon Mar 26, 2007 1:44 pm
by chulett
It's not weird. You've had two people asked about the value you were using for scale - don't you think that's a big clue? :P

Posted: Mon Mar 26, 2007 1:44 pm
by chulett
Sorry, three people. :wink:

Posted: Mon Mar 26, 2007 2:41 pm
by nkln@you
Yes,

Sorry that I could not grab the issue in Scale. I changed my datatype in database from NUMBER to NUMBER(38,12). Now I am getting the required output.

I have a small doubt . even NUMBER should accept Decimal digits right?

Posted: Mon Mar 26, 2007 2:43 pm
by DSguru2B
NUMBER with precision will accept decimal. Without precision will just be an integer.

Posted: Mon Mar 26, 2007 4:00 pm
by swades
Please make the post Green