Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Keep leading zeros when saving to CSV

Hi,

I have text field (Kostenplaats) which in some cases contains leading zero. I wrap the field in TEXT() function and the Qlikview shows it correctly in Qlikview. However when I store the resident to CSV, Qlikview drops the leading zero and perceives the field as a number.

FOR EACH vBatch in $(vBatchList)

  exportFactuurBatch:

  Load

  Datum,

TEXT(IF (labelId =1 , '08 ', '608'))        AS Kostenplaats,

  'D' AS Accounttype

resident Inputfile

WHERE Batch = '$(vBatch)'

;

  LET vOutputFile = 'Webshopgiftcard Factuur Batch '&  '$(vBatch)' & '.csv';

  // store output file in intermidiate server location

  store * fro

m exportFactuurBatch into [$(AfasOutputLocation)\$(vOutputFile)] (txt,  delimiter is ';') ;

output:

Capture.PNG.png

This should be easy, right?

Dror

4 Replies
Gysbert_Wassenaar

Did you open the csv file in Excel of in a text editor? If it's Excel it's possible Excel is interpreting the text as numbers and dropping the leading 0.


talk is cheap, supply exceeds demand
Not applicable
Author

In both. Both are dropping the leading zero's

Gysbert_Wassenaar

I can't reproduce this. The leading zero and the trailing space are preserved in the csv file here. Can you post an example file that reproduces the issue?


talk is cheap, supply exceeds demand
vamsee
Specialist
Specialist

Hi,

I was just working on a similar issue. You might have found the way, but for people with similar issues.

Store CSV file using semicolon instead of colon

It is a feature of excel to trim the zeros when uploaded from a different source. Sadly we cannot change that feature.

But if one reads the same file again back into Qlik the preceeding Zero's come in.