Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mahamed_Qlik
Specialist
Specialist

Number from string

Hi 

 

I have following string values, I want to pull out only first numeric values from it.

1hhhkhkk

2hihihho

12jkjljlj45

22liyuoiuiou3

121hh56khjh

 

Expected output - 1,2,12,22,121

Kindly help

Regards,

Mahamed

Labels (1)
6 Replies
MatheusC
Specialist
Specialist

Olá, 

Tenta utilizar a função abaixo:

 

KeepChar(campo,'0123456789')

 

MatheusC_0-1661862958189.png

 

 

Obs: o nome campo é o nome que dei a tabela para usar como exemplo 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Mahamed_Qlik
Specialist
Specialist
Author

Hi Mathews,

I have numbers in between the string as well..
ex - 1hhjhhj43hkhkj
         4dasds987hkj

 

In this case it s returning all the numeric from the string but we need only first numeric values from string...

Or
MVP
MVP

Left(YourField,FindOneOf(YourField,'abcdefghijklmnopqrstuvwxyz')-1)

Note that if your text can include other characters, or uppercase, you'll need to add those to the FindOneOf section.

Mahamed_Qlik
Specialist
Specialist
Author

Hi Champion

I can see your solution is partially correct.
I have single value as 0(zero) in the list so for zeros it is not working.

Or
MVP
MVP

There are no values of zero for any of your sample values. This precisely matches your expected output:

Or_0-1661863723497.png

 

MatheusC
Specialist
Specialist

Olá, mahamedfaijan

Utilizei a expressão a expressão fornecida pelo  Champion, e funciona muito bem.

Caso atenda sua expectativa marque a resposta do Champion como solução para finalizar sua questão.

Grato!

 

MatheusC_0-1661868801165.png

 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!