Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
naziralala
Creator
Creator

CSV File Leading Zeros and 0 in display

Hi All,

I am faced with a new challenge.

My leading 0's, example- 005678 is being seen in my output csv file written by sql script as 5678.

Also, if the amount is 0, it does not display the same, the field is empty.

Please assist with an example in sql code to resolve the same.

Thanks in advance. !

15 Replies
robert_mika
Master III
Master III

What is your data source?

This is probably problem of the database? your are using.

Feeling Qlikngry?

How To /Missing Manual(25 articles)

manojkulkarni
Partner - Specialist II
Partner - Specialist II

You can use below code to replace zeor's

replace(ltrim(replace(FIELD, '0', ' ')), ' ', 0)

amit_saini
Master III
Master III

sasikanth
Master
Master

HI,

Try Text(Field)

naziralala
Creator
Creator
Author

Hello Sunny,

I tried this. But does not work.

Let me provide some sample data as below:

   

CodeNameBrandP Booking RPY PxPbookC Booking RCPxCBookingsYO Sale%YO Px%YOBooKs%
525281BONDB299.99149905.415229-41.40%-41.20%-39.60%
525281BONDG 7583.44916
DIRECTABCB2424.271968520802.521521534-18.90%-20.90%-21.70%
31738036AAB2057.281451647.449437-36.80%-33.60%-31.50%
31738036AAG 8860642
37380362 TOURSB7292.95120414171.066527-47.70%-46.70%-38.60%
33754036POWERB9931.1259023613.63410-58.10%-49.20%-50.00%

I need to display 00525281 and 0 where no value and YO Sale % i need a 100%

Nazira

Anonymous
Not applicable

If your code values are all the same length, you can add leading zeros by RIGHT('00000000' & Code, 8). 

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Try to use Num(Code) or format it with Num#( Code)

naziralala
Creator
Creator
Author

My code is the same length, but when I store in qvd/ or open the csv file in notepad, I have the zeros displayed.

Please advise..

thanks.

jeroen_wagner
Partner - Creator
Partner - Creator

Can you provide us with the model/script?
Your Load interprets the field as a numeric field, so it removes zero's.