Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
May 18th 10AM ET, Live Chat, bring your QlikView questions. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
sparur
Specialist II
Specialist II

How I can remove leading zeroes

Hello, colleagues.I have a small problem, which I can't resolve elegant.

I want to remove leading zeroes from my Data.

I tried to do some text / num converting, but it didn't help me.

See attached file

31 Replies
berndjaegle
Creator II
Creator II

Very nice. Thanks Rakesh.

brooksc57
Creator
Creator

awesome!!!!

ruben_antelo
Partner
Partner

Hi Anatoly,

Just one more possible solution for future readers...

num( EVALUATE(FieldToDeleteLeadingZeros),'#0') as MyNumber

Not applicable

I guess this is an old thread, but I remove leading zeroes by replacing them with blanks and then using ltrim on load like this:

replace(ltrim(replace(FIELDNAME,'0',' ')),' ','0')

It seems to work and is pretty elegant.

Not applicable

I use this formula:  replace(ltrim(replace(FIELDNAME,'0',' ')),' ','0')

and it seems to work.

cesarsfl
Contributor
Contributor

Hi Rakesh,

Nice to see you here!. Was looking for a solution to this and found your answer, however I think this won't work for all scenarios.

If I have a material number: 00-001-002, this solution will return -001-002 therefore I enhance a little bit your already elegant solution:

if(purgechar(MATNR,' 0123456789') = '',replace(ltrim(replace(MATNR, '0', ' ')), ' ', 0),MATNR)

Regards,

Cesar

vigneshwaranmk
Contributor III
Contributor III

Thanks. This worked well for me

andy
Partner
Partner

I use

num(num#(FieldName))

bujnakbranislav
Partner
Partner

I use EVALUATE([FieldName] & '* 1') as replace(ltrim(replace(FIELDNAME,'0',' ')),' ','0') was also removing 0 inside the string, not just leading 0s

JustinDallas
Specialist II
Specialist II

What on earth does that * 1 do?