3 Replies Latest reply: Sep 4, 2014 12:08 PM by Marco Wedel RSS

    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