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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert String To integer?

hi,
I have attached my job.. in that i ll get all datas from input file as string and store that as a string datatype in the postgres output also.
now i need to convert some of the datas to Integer type.. at which position i need to change the datatype.. and which is the component  to be used to do that....
0683p000009MEDg.png
Labels (2)
7 Replies
Anonymous
Not applicable
Author

You have already used a component for converting data types i.e. tConvertType... besides this component, you can simply use tJavaRow and make use of java functions like Parse to convert string to integer data types
context.variable = Integer.parseInt("1234");

Thanks
Vaibhav
Anonymous
Not applicable
Author

Hi,
There is a tConvertType component in your job design. How did you set it? Why didn't you use it to convert String to Integer type then loading data into DB?
Could you please give us more info about your job situation?
Best regards
Sabrina
Anonymous
Not applicable
Author

hi,
+1 for tConvertType 0683p000009MACn.png
you see graphicaly that you're converting type in your job. 
When it's in a blackbox like tmap or hard coding somewhere else it's more difficult to trace what you've done 0683p000009MA9p.png
regards
laurent
Anonymous
Not applicable
Author

hi all ,
thanks for your replies.. i have used the tconverttype component for setting NULL to the empty values.. for that only i used tconverttype. eventhough i have checked Autocast option , But i don't know how to use this component to change the data type. please help me 
Anonymous
Not applicable
Author

Hi,
Please see component reference TalendHelpCenter:tConvertType with related scenario.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi xdshi,
 Thanks for your Reply,But the Problem is i am having the data like ($0.00).. so i take this as string type in tfiledelimited schema,
then i used the tconverttype,checked the auto cast option. and in the schema of the tconverttype i changed the datatype to Decimal, because i am not having the dollar datatype .. then i passed to the postgres output.. when i run i get zero rows .. and the error is
null.
please help to sort out this
Anonymous
Not applicable
Author

Hi,
If currency data type is considered as string, then you will have to trim first char from the string and then convert it using tconverttype... else results are wrong.. Use stringhandling.Right(stringhandling.Length(yourrow.column)-1)
Vaibhav