Data type conversion in Talend Community Vesrsion

Five Stars

Data type conversion in Talend Community Vesrsion

Dear team,

 

Now I've created one job to load data from CSV to MySql database. The data type from csv is not match to mysql table data type, so I need to change data type. Then I use tConvertType but I got null or error after running the job.

 

I work around with configuration in tConvertType and tMap but it doesn't work. For example there is phone number in csv with integer data type but i have to convert to string before loading to mysql database. could anyone please give me the sample job like this.

 

Thank you.

Community Manager

Re: Data type conversion in Talend Community Vesrsion

For the telephone number you can simply set the column for the file import component (I assume you are using a tFileInputDelimited) to String.

 

With regard to the errors you were getting, could you post them? 

Eight Stars

Re: Data type conversion in Talend Community Vesrsion

use this string.valueof(row1.phonenumber), or else in the csv while writing metadata, you can change to string instead of using integer, this both of the solutions will work

 

 

Warm Regards,
Please don't forget to give Kudos if it resolves issue, and if you think its Apt you can also mark its as solution.
Community Manager

Re: Data type conversion in Talend Community Vesrsion

This will not work. If a telephone number such as 07555123456 is read as a number by the tFileInputDelimited, then the leading zero will be removed and you will end up with 7555123456. The telephone number must be read as a String from the beginning.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads