Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
francisvandergr
Partner - Creator II
Partner - Creator II

Text left from last space

I have a question. Is there a function to get a part of a field left from the last space in that field. For example

I have field "Name "  with the following values:

van den Bergh

Jansen

van Achteren

van der Grijn

Pietersen

In this example i need the values :

van den

van

van der

How is this possible with QV?

1 Reply
Miguel_Angel_Baeyens

Hi Francis,

I'd use something like the following in the script

If(Index("Name ", ' ', -1), Left("Name ", Index("Name ", ' ', -1) -1), 'No Space') AS Req

That reads if there is a space in the current value of "Name " then return all characters from the left until the last space, if there is no space, return "No Space".

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica