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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
RAJ6
Contributor III
Contributor III

Talend adding extra zeros values for string columns

Hi Talend Folks,

 

 Am face issue while generate data source to destination for string column. Before adding extra zeros for that column values in talend output excel file. My source file is excel and output file is also excel.
I need same input format values to output
My input is below format 
4567567
4536785
4567890
45678905678-01
45675458765-02
 
I got this format value
0000000456756
0000000453678
0000000456789
45678905678-01
45675458765-02
Kindly share your information as soon as possible.
Labels (3)
4 Replies
Anonymous
Not applicable

Hi,

 

Talend will not add extra zeros at the front, without some specific logic somewhere.  Are you sure your target Excel file does not have a column format defined that is showing these extra zeros? 

Unless you have specified a format in the schema definition, or somewhere in your job, or your target Excel has a format defined on the column, I don't where this will be coming from.

 

Irshad

manodwhb
Champion II
Champion II

@RAJ,your excel file might have leading zeros format.

TRF
Champion II
Champion II

Using a tJavaRow you can do that:

output_row.yourField = 
  input_row.yourField != null && input_row.yourField.length() == 14 ? 
      input_row.yourField : 
("00000000000000"+input_row.yourField).substring(("00000000000000"+input_row.yourField).length() - 14);

Here is the result:

Démarrage du job test a 10:02 31/05/2018.
[statistics] connecting to socket on port 3847
[statistics] connected
00000004567567
00000004536785
00000004567890
45678905678-01
45675458765-02
[statistics] disconnected
Job test terminé à 10:02 31/05/2018. [Code sortie=0]

 

 

TRF
Champion II
Champion II

@RAJ, I read you case too fast and thought you want to add leading zeros.

Then I try to push your sample content to an Excel file (field field defined as String) and it works fine, no leading zeros in the output file.