Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
has75042
Creator
Creator

Extract numbers from one line field

From the below field, how do I extract numbers

Capture.PNG

for example:

004583 

0002195 

001

20040921

 I am using the trim left and mid function this is the right function to use?

Thanks in advance. 

1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try this

 

LOAD

subfield ([Your numbersfield], ' ') as [Extracted number],

...

FROM source;

 

View solution in original post

9 Replies
jwjackso
Specialist III
Specialist III

If the fields are fixed width, that may be the easiest method.  It looks like most of the fields are space delimited, you might want to look at the subfield function

Vegar
MVP
MVP

Try this

 

LOAD

subfield ([Your numbersfield], ' ') as [Extracted number],

...

FROM source;

 

has75042
Creator
Creator
Author

subfield function seems to be working. 

SubField(ABNOTE, ' ', -1) is giving me this # 0200709190660, how do I convert this number into date.

sasiparupudi1
Master III
Master III

SubField('004583 0002195 001 20040921',' ',1)

SubField('004583 0002195 001 20040921',' ',2)

SubField('004583 0002195 001 20040921',' ',3)

SubField('004583 0002195 001 20040921',' ',4)

has75042
Creator
Creator
Author

Hey,

 

How can I convert this #  0201010310600 into date.

I have tired make date function, floor. None of them seems to be working. Please let me know a function that I can use to convert above number into date

Thanks in advance.  

jwjackso
Specialist III
Specialist III

How does the number 0201010310600  represent a date?  Is it Oct 31 2019 at 6 am?  Why does it have a leading zero.  Is it the number of milliseconds, seconds, minutes from a date?

has75042
Creator
Creator
Author

Yes, it is Oct 31 2019 at 6 am. The leading zero doesn't represent anything. I need to remove that leading zero

jwjackso
Specialist III
Specialist III

The MakeDate function worked.  I would have expected the Date# function to work.

 

=MakeDate(Num#(Mid(DT,2,4)),Num#(Mid(DT,6,2)),Num#(Mid(DT,8,2)))

 

sasiparupudi1
Master III
Master III

Try Timestamp

=Timestamp(Timestamp#(Num(A),'YYYYMMDDhhmm'))