How to create a float by dividing two 'int's?

One Star

How to create a float by dividing two 'int's?

Hi,
I'd like to generate a calculated metric in my Talend job, namely a percent
At this point I have tried dividing two integer columns A / B in a tMap with the data type set to Float
I'm not getting decimal values through to my MySQL table; they're showing up as integers
My MySQL column is set to decimal data type length of '5,2'
I don't have a length specified in my Talend schema as I didn't know how to express it
Could use some help in getting my percentage working Smiley Happy
Thanks
Four Stars

Re: How to create a float by dividing two 'int's?

Use (float) to convert your integer number division to float in tMap. say (float)(A/B). You already have your output column as float. So it should work.
Vaibhav
One Star

Re: How to create a float by dividing two 'int's?

Hi, and thanks Smiley Happy
I ended up just using the (float) on the first int, since that also works:
(float)row.col1/row.col2