Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Finding the index of the first non zero character in a string


I have a [Serial Number] field which can appear like the following : 000000000000002216

I want to make it 2216 but the amount of zero characters (from the left) can vary from one Serial Number to another.

So, I would like to find a way to retrieve the index of the first non zero character so that I will be able to use the Mid function.

I already tried : Mid ([Serial Number] , '<>0') but it didn't work.

Thank you (:

12 Replies
Specialist II
Specialist II


May be try this:

[Serial Number] * 1 as [Serial Number]


Check out the almost-never-used function FindOneOf().

Details can be found here: FindOneOf ‒ QlikView


Be careful with one of the "capacity limits" of QlikView.. "Numbers" with more than 14 (or is it 15) digits will not be treated as numbers but will remain text-only.


Even when multiplied by 1? 000000000000001 * 1 won't end up as 1?

Specialist III
Specialist III

Maybe a tweek a bit like this:

In the script:

(num([Serial Number]) * 1) as [Serial Number]

=num(00000000000000000000000000000001) * 1

Best regards,



I think we don't really need to add the Num function, unless you really want to add it. I think * 1 convert the text into a number and will get rid of 0s at the start. But Peter mentioned something interesting and I am not sure if that impacts the multiplication with 1. Waiting for his response to come through

Specialist III
Specialist III

I've put the num just in case the length of the characters is to high like my example above and to be sure that all the values are converted to number value


If Num() is used for converting it to number, then why do you need * 1 for?