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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
stagliaferri1640766615
Contributor II
Contributor II

filling number with 0 while exporting using tFileOutputDelimited

Hello Community,

I am creating a very simple job - reading data from database and exporting the result set in csv

using tDBInput to read the data, tFileOutPutDelimited to export the data

in the select statement I am converting an amount as DECIMAL (10,6) so in the result set I have

  • 0.000487
  • 0.144300

etc. etc.

and in the schema I defined it as Double as Type, Decimal as DB type with lenght 10 and precision 6

when I edit the csv output using notepad++ all the zeros as the end of the numbers are gone. so

  • 0.000487 --> in the csv I get

    0.000487

  • 0.144300

    --> in the csv I get 0.1443

is there a way to have all the 6 decimals even if 0s ?

thanks

sergio

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

I think the easiest way to achieve this is to output the decimals as String to the file (CSV files are essentially file of Strings anyway), then use code like this (maybe in a tMap before the output component) to format the numbers....

 

String.format("%.6f", row1.doubleColumn)

 

 

View solution in original post

2 Replies
Anonymous
Not applicable

I think the easiest way to achieve this is to output the decimals as String to the file (CSV files are essentially file of Strings anyway), then use code like this (maybe in a tMap before the output component) to format the numbers....

 

String.format("%.6f", row1.doubleColumn)

 

 

stagliaferri1640766615
Contributor II
Contributor II
Author

it worked!!! thank you very much!