Qlikview Remove Unwanted Characters with PurgeChar Function

This post will show a simple example of how to remove a specified character from a string coming in through the Load Script.  The Qlikview PurgeChar function is a simple solution for this problem, and can easily be added to a chart or load script.

 

From Qlikview Help

PurgeChar() returns a string consisting of the characters contained in the input string (‘text’), excluding any that appear in the second argument (‘remove_chars’).

Syntax:  PurgeChar(text, remove_chars)

  • text – the original string
  • remove_chars – string containing characters in text to be removed

Qlikview PurgeChar Setup

Add the following to your Load Script, then load the data into your Qlikview application:

Next, add a Table Box to display the raw field content:

Qlikview PurgeChar

Go back and update your Load Script to include the added section below:

Here, I added two derived fields, to remove the pipe character “|” from the “Player” field, and the ampersand character “@” from the “Opp” field.  The derived fields were named with “_Clean” so you can see the before and after result for each field.

Reload the data and add the new fields to your Table Box, like the following:

Qlikview PurgeChar

Observe:

  • New field “Player_Clean” no longer contains the pipe character “|”
  • New field “Opp_Clean” no longer contains the ampersand character “@”

 

Please modify to suit your needs!  If you have any questions, or would like to see anything else on the sight, either post a comment to this post or send me a message via the Contact page.

 

Additional Content

Check out more examples by visiting my Home Page

Here you will find topics covering  Qlikview  SQL Server  Excel VBA

 

 

Leave a Comment