Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
mtfisch7864
Contributor
Contributor

Finding numeric strings

I have a need to extract up to 4, 9-digit consecutive numbers from an unstructured text string in a load script. Here is an example,

JtR56743  tid lengths,,123456789   0846 987654321nnbfetgw,135796616

Result is:

123456789

987654321

135796616

Mike F

 

 

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Try this method

1. Replace all non digit symbols with an odd symbol like '|'.

2. Run the data through subfield() using only two parameters, like this

SubField(YourField, '|') as SubNumber

3. You now have generated a row per number in dour data, now you need to filter it. You can do that by loading a Resident load on your output table with a where condition.

Noconcatenate LOAD... RESIDENT... WHERE LEN (SubNumber) =9

4. You now have a table containing your 9 digit values.

Good luck! 

View solution in original post

1 Reply
Vegar
MVP
MVP

Try this method

1. Replace all non digit symbols with an odd symbol like '|'.

2. Run the data through subfield() using only two parameters, like this

SubField(YourField, '|') as SubNumber

3. You now have generated a row per number in dour data, now you need to filter it. You can do that by loading a Resident load on your output table with a where condition.

Noconcatenate LOAD... RESIDENT... WHERE LEN (SubNumber) =9

4. You now have a table containing your 9 digit values.

Good luck!