Calculating Precentage of Int but get exception in thread error in tMap

Seven Stars

Calculating Precentage of Int but get exception in thread error in tMap

In my tMap I have an input flow with an integer value and I need to calculate a set percentage of it for output flow. 

 

(row1.Integer_Numeric/100*45) 

Is the calculation I have in the expression builder of a float variable but no matter what value I have for row1.Integer_Numeric I get 0 in the output flow without any compiler errors when I run the job.

 

If I use the test feature in expression builder I get

Exception in thread "main" java.lang.Error: Unresolved compilation problems

 

Do I need to cast the result of the calculation to a float within the expression builder or use a different datatype in the output flow?


Accepted Solutions
Seven Stars

Re: Calculating Precentage of Int but get exception in thread error in tMap

It seems I needed to convert the integer to a float value first using 

row1.Integer_Numeric.floatValue()

so that the calculation would work. I incorrectly assumed just the result needed to be a float when the input value was integer


All Replies
Seven Stars

Re: Calculating Precentage of Int but get exception in thread error in tMap

Also the calculation seems only to work when the integer value is 100 ie. a number without a decimal place

Seven Stars

Re: Calculating Precentage of Int but get exception in thread error in tMap

It seems I needed to convert the integer to a float value first using 

row1.Integer_Numeric.floatValue()

so that the calculation would work. I incorrectly assumed just the result needed to be a float when the input value was integer