Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

Extract numbers

Hello,

I have this:

FieldNumbers:

0009533544-2

0005345344-0

0012445665-4

0013445332-K

I would Like to Obtain This:

9533544-2

5345344-0

12445665-4

13445332-K


Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD SubField(FieldNumbers, '-', 1) * 1 & '-' & SubField(FieldNumbers, '-', 2) as FieldNumbers;

LOAD * Inline [

FieldNumbers

0009533544-2

0005345344-0

0012445665-4

0013445332-K

];

View solution in original post

3 Replies
sunny_talwar

Try this:

Table:

LOAD SubField(FieldNumbers, '-', 1) * 1 & '-' & SubField(FieldNumbers, '-', 2) as FieldNumbers;

LOAD * Inline [

FieldNumbers

0009533544-2

0005345344-0

0012445665-4

0013445332-K

];

maxgro
MVP
MVP

maybe

Table:

LOAD

     Replace(Ltrim(Replace(FieldNumbers, '0', ' ')), ' ', '0');

LOAD * Inline [

FieldNumbers

0009533544-2

0005345344-0

0012445665-4

0013445332-K

];

MarcoWedel

Hi,

an alternative solution might be to purge the leading zeros like:

Replace(Replace(LTrim(Replace(Replace(FieldNumbers,' ','@SPACE@'),'0',' ')),' ','0'),'@SPACE@',' ')

or

Mid(FieldNumbers,FindOneOf(FieldNumbers,PurgeChar(FieldNumbers,'0')))

(see Comparing these two numbers)

hope this helps

regards

Marco