Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ahidu1030
Contributor II
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
sunny_talwar

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

View solution in original post

3 Replies
sunny_talwar

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
Master III
Master III

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

ahidu1030
Contributor II
Contributor II
Author

It works perfectly!!!!

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