How to remove a single quote from a string in QlikView?

Ok, so I had a problem today that I couldn’t find any documentation on. I needed to remove a single quote from a variable in a string during a load script but it took some time.

I tried this but it didn’t work:

purgechar(‘It’s got a quote’, ‘\”)

It turns out that QlikView doesn’t seem to have an escape character, so I had to figure out another method. Google searching for this string didn’t help: single quote Qlikview escape character

So I figured it out. You have to use the chr() function.

purgechar(‘It’s got a quote’, char(39))

You can get the correct ascii number to pass to the char() function from here:

So hopefully if you do the same google search you will find my post and not have to spend as much time as I did trying to figure this out.


  1. Sharma says:

    Thanks a lot for sharing Jeff. That was very much helpful and I was looking for it since very long.

  2. Jeff says:

    It is chr() instead of char() in version 8.5:

    purgechar(‘It’s got a quote’, chr(39))

Leave a Reply

How to post code in comments?