Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bfournet
Partner - Contributor II
Partner - Contributor II

Count leading spaces in a string

Hello! Sorry in advance for my english.

Here is my question: I would like to import data from an Excel file containing one column ("Siege") with leading spaces records.

But while loading data into qlikview, leading spaces are automatically suppressed even using Text() function:

...

Text(Siege) as Siege,

...

The workaround I found is to modify the "Verbatim" variable before loading data and it works fine :

Set Verbatim = 0;

To count spaces of each record, i created a new column using :

substringcount(Siege,' ') as Hierarchie,

Capture2.PNG.png

I can retrieve the correct number of leading spaces for the first three records. It doesn't work for the last one because i don't want to count space between 'S4' and 'London' but only before 'S4'.


So how can I only count leading spaces in a string ??

Thank You for your help

1 Solution

Accepted Solutions
Anonymous
Not applicable

( len(Siege) - (len( ltrim(Siege))))

View solution in original post

3 Replies
Anonymous
Not applicable

( len(Siege) - (len( ltrim(Siege))))

bfournet
Partner - Contributor II
Partner - Contributor II
Author

Hello, it works fine and the solution more simple than I expected

Thank you !

MarcoWedel

Hi,

maybe this thread is also of interest for you:

loading data

hope this helps

regards

Marco