Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mobmsc2
Creator
Creator

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?

Labels (3)
1 Solution

Accepted Solutions
mobmsc2
Creator
Creator
Author

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

View solution in original post

2 Replies
mobmsc2
Creator
Creator
Author

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

mobmsc2
Creator
Creator
Author

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