Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
HemaS1
Contributor III
Contributor III

Leading zeros are removed when using tfileoutputdelimited

Hello,

I have data extracted from SQL server DB table and when it output to CSV file using tfileoutputdelimited the leading zeros are deleted. For example '02193' becomes '2193'.

I verified that the column has a datatype of string from DB to tfileoutdelimited.

Need help on how to fix this.

Thanks,

Hema

Labels (2)
1 Solution

Accepted Solutions
HemaS1
Contributor III
Contributor III
Author

I just opened the file and look at it.

This is what I see... It is an comma seperated excel file.

 

 

0695b00000N4YwTAAV.png

View solution in original post

13 Replies
Anonymous
Not applicable

If the value coming from the DB is a String of "02193" it can only be changed to "2193" if it is converted to an int or the leading character is removed. This won't happen by accident. Can you check every component that the data passes through to ensure that everything is set to String? Maybe show us a screenshot of your job and the source and target component schemas.

HemaS1
Contributor III
Contributor III
Author

Thank you for responding.

 

Here are the screen shots:

tdbInput:

 

0695b00000N4Y8xAAF.pngtfileoutputdelimited:

0695b00000N4YAKAA3.png

Anonymous
Not applicable

Can you replace the tFileoutputDelimited with a tLogRow and check the output to the System.out window?

 

Oh, one more thought, are you reading the CSV via Excel? Could this be the formatting in Excel? Check the file using a textpad if you are using Excel.

HemaS1
Contributor III
Contributor III
Author

The value read from tdbinput to tlogrow is coming out correctly as shown with the laeading zero:

 

0695b00000N4YI9AAN.png 

I am reading the values directly from database and the schema and the screen shot is above.

 

Here are the settings for this tfileoutputdelimited.

 

0695b00000N4YK0AAN.png 

Advanced settings:

0695b00000N4YKtAAN.png 

 

0695b00000N4YLDAA3.png

Anonymous
Not applicable

How are you reading the the CSV file?

HemaS1
Contributor III
Contributor III
Author

The data comes from DB query and output to CSV file.

 

0695b00000N4Yq1AAF.png

Anonymous
Not applicable

How do you know what is in the file?

HemaS1
Contributor III
Contributor III
Author

SOrry, could you clarify?

 

I look at the tlogrow to see what is coming from DB and look at the output file.

 

Anonymous
Not applicable

How do you know that the leading zeros are deleted? What software do you use to look at the CSV file?