Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
ahidu1030
New Contributor II

identify String or Text and eleminate the zeros at the beginning

Hey Guys,

I have a dimension "Material Number", where the numbers can be

000002525451012,

0000000695748,

P IND XXX,

B7TRCXX

As result I shall get:

2525451012,

695748,

P IND XXX,

B7TRCXX

if only contains figures and there are zeros at the beginning then the zeros at the beginning have to eliminated. If it contains Letters, the material number shall remain so.

How shall I write in the script?

thank you.

1 Solution

Accepted Solutions

Re: identify String or Text and eleminate the zeros at the beginning

Check here:

How to Trim Leading Zero's from Numeric value of a Alpha Numeric datatype

If(IsNum(Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0')), Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0'), CUSTOMER) as Customer

or

Alt(Num(Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0')), CUSTOMER) as Customer

3 Replies

Re: identify String or Text and eleminate the zeros at the beginning

Check here:

How to Trim Leading Zero's from Numeric value of a Alpha Numeric datatype

If(IsNum(Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0')), Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0'), CUSTOMER) as Customer

or

Alt(Num(Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0')), CUSTOMER) as Customer

antoniotiman
Honored Contributor III

Re: identify String or Text and eleminate the zeros at the beginning

Alt(Num(Left(Field,14)),Field)

ahidu1030
New Contributor II

Re: identify String or Text and eleminate the zeros at the beginning

It works perfectly!!!!

Thanks a lot. Exactly the same problem as in the referenced post.