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

How to retrieve the position of a digit [1-9] in the first five characters of a string

Hi all,

I need your help to determine how to retrieve the position of a digit [1-9] within the first five characters of a string?

For Example:

Ex1:

001023456789   first digit other than zero is 1 and it is located at position 3

Ex2:

000123456789  first digit other than zero is 1 and it is located at position 4

Ex3:

0000123456789  first digit other than zero is 1 and it is located at postion 5

Ex4:

010123456789  first digit other than zero is 1 and it is located at position 2

1 Solution

Accepted Solutions
IAMDV
Luminary Alumni
Luminary Alumni

Have you tried something like this:

=FindOneOf ('001023456789', '123456789')

OR

=FindOneOf ( Left(YourField, 5), '123456789')

Cheers,

DV

www.QlikShare.com

View solution in original post

4 Replies
IAMDV
Luminary Alumni
Luminary Alumni

Have you tried something like this:

=FindOneOf ('001023456789', '123456789')

OR

=FindOneOf ( Left(YourField, 5), '123456789')

Cheers,

DV

www.QlikShare.com

MK_QSL
MVP
MVP

Load

  *,

  FindOneOf(Left(Number,5),'123456789') as Digit

Inline

[

  Number

  001023456789

  000123456789

  0000123456789

  010123456789

];

Not applicable
Author

Deepak and Manish, thank you both.  Both of your answers are correct.  This function is exactly what I was looking for.

Please note that I cannot mark both answers as correct, because the selections boxes won't let me do it. but, again, I'm very grateful for your assistance and support.


IAMDV
Luminary Alumni
Luminary Alumni

NP at Robert. I'm glad you got want you were looking for!

Cheers,

DV