How to keep leading zero in CSV file when exporting a report

PatriciaA987250
Tera Expert

Hi,

 

I'm creating a report using database view and the report will be exported to a csv file format. The report generation and distribution will be automated. The issue here, when the report exported to csv file format, some data are not displaying as expected e.g. those values with leading zero (00012345 only display as 12345). How can i address this issue? kindly advise.

 

5 REPLIES 5

MP12
Mega Guru

Hi, if you generate your report, you may add a leading apostrophe to the value you want to keep the 000, e.g. '00000. This can be done with different options.

Could you please provide more details on how to go about it.  Since the report generation and distribution will be automated, how can i achieve this. Is it via system properties or can handle through database view?

One solution would be to either update the field with a leading apostrophe through a client script on update for example. You can also create a hidden field to hold this value with leading apostrophe. In the database view, the report should take this updated field. The issue is not the csv export which has the leading 000 but when Excel opens the file. 

Sorry for the late reply, now the requirement has been changed, I will be creating a report using database view and the report(csv) will be exported to mid server. Please provide examples of scripts/steps to append apostrophe via export set or database view.