Five Stars

[resolved] CONVERT STRING TO INTEGER

Hello All,
I want to convert my input column (String type) to Integer in my tMap
In my input i have these values for exemple
"0.23"
"2.45"
"9.57"
So i test these both function:   Integer.parseInt()  or Integer.valueOf().
But it does not. I also change all dot to comma in input like that:
"0,23"
"2,45"
"9,57"
But nothing
Thanks for help,
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] CONVERT STRING TO INTEGER

Hi IDEMBELE,
What error does the console state when running your small test job?
Also, the Integer data type cannot hold decimal values, only the whole numbers. I think that is whats causing the error. You have to either:

change input values to whole numbers; or
change Integer data type to float or some other similar data type that handles decimals
4 REPLIES
One Star

Re: [resolved] CONVERT STRING TO INTEGER

You probably need to get rid of the quotes first.
Five Stars

Re: [resolved] CONVERT STRING TO INTEGER

Hi janhess2,
I am not sure because i make test with a small job but it does not work.
See the screenshot of job please

And down the config of tFixeFlowInput component

Thanks for help,
One Star

Re: [resolved] CONVERT STRING TO INTEGER

Hi IDEMBELE,
What error does the console state when running your small test job?
Also, the Integer data type cannot hold decimal values, only the whole numbers. I think that is whats causing the error. You have to either:

change input values to whole numbers; or
change Integer data type to float or some other similar data type that handles decimals
Five Stars

Re: [resolved] CONVERT STRING TO INTEGER

Thanks junmilsso