Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

andreyfcdk91
New Contributor III

Index of last left zero in string

Colleagues, good day!

Some questions about string fuction Index...

I have simple table, which contain num and text values with leader zeros.

 

Test
006545
005
35
45
43
00fdfsdfsd
00yuturt
0665
0fdhfg00

I need to suppress them. My idea to use left function and index of last left zero.

How i can find this index in expr?

thanks.

1 Solution

Accepted Solutions
MVP
MVP

Re: Index of last left zero in string

May be this:

=Mid(Test, FindOneOf(Test, 'abcdefghijklmnopqrstuvwxyz123456789'))


Capture.PNG

8 Replies
MVP
MVP

Re: Index of last left zero in string

May be this:

=Mid(Test, FindOneOf(Test, 'abcdefghijklmnopqrstuvwxyz123456789'))


Capture.PNG

sureshqv
Esteemed Contributor III

Re: Index of last left zero in string

is this you need?

a:

LOAD * Inline

[

Test

006545

005

35

45

43

00fdfsdfsd

00yuturt

0665

0fdhfg00

];

LOAD *

,

PurgeChar(Test,'0') as newvalu

Resident a;resu.PNG

MVP
MVP

Re: Index of last left zero in string

or this:

=Mid(Test, FindOneOf(Lower(Test), 'abcdefghijklmnopqrstuvwxyz123456789'))

MVP
MVP

Re: Index of last left zero in string

This will remove any 0... I don't think this is what the OP wants

andreyfcdk91
New Contributor III

Re: Index of last left zero in string

Thanks)

Could you explain me please, how works this two functions?

andreyfcdk91
New Contributor III

Re: Index of last left zero in string

Thanks, but i need to remove only left zeros.

andreyfcdk91
New Contributor III

Re: Index of last left zero in string

yes)

MVP
MVP

Re: Index of last left zero in string

FindOneOf will look for the first occurrence of the values supplied

FindOneOf(Test, 'abcdefghijklmnopqrstuvwxyz123456789')

Notice how I did not give 0 in the list. Once you know the location of the 1st non-zero number, you just use a Mid function where you tell where to start.