
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is KeepChar and PurgeChar give me an example
Hi All,
I am new to Qlikview
What is KeepChar and PurgeChar give me an example
plz help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keepchar(string1 , string2) -- Returns the characters in string1 which appears in string2 ..
Keepchar(qlik1234, 12) returns 12 as 1&2 are the characters that are part of qlik1234..
Keepchar(qlik1234, 125) returns 12 as 1&2 are the characters that are part of qlik1234 and 5 is not present in qlik1234..
Keepchar(qlik12234, 12) returns 122 as 1&2 are the characters that are part of qlik12234 and multiple characters are returned multiple times..
Keepchar(qlik1223411, 12) returns 12211 as 1&2 are the characters that are part of qlik12234 and multiple characters are returned multiple times and the characters are returned in the same order of appearance..
purgechar is the oppostite of keepchar.. it returns the characters that are not present in the second string
Purgechar(qlik1234, 12) returns qlik34 as q,l,i,k,3&4 are the characters that are not part of 12..
Purgechar(qlik1234, 125) returns qlik34 as q,l,i,k,3&4 are the characters that are not part of 125..
Purgechar(qlik12234115, 12) returns qlik345 as q,l,i,k,3,4&5 are the characters that are not part of 125 and the characters are returned in the same order of appearance..
Hope your doubt is cleared.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You got a good thorough answer from @msKarthikeyan . I just want to point out that both parsmeters in the the functions are strings (text) you should use single quotations even hard coding the parameters like this:
Keepchar( 'qlik1234', '1q2' )
And
Purgechar( 'qlik1234', '1q2' )
When comparing a field to string you do like this
Load
KeepChar(FieldName, '1q2' ) as Kept,
KeepChar(FieldName, '1q2' ) as Purged,
Amount
Inline [
FieldName, Amount
qlik123, 3
Join234, 1
]
Qlik Community MVP
.png)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please be sure you close out your thread by using the Accept as Solution button on the post(s) that got you the information you needed, this gives credit to the posters and lets the other Members know what helped. Please be sure to circle back and complete this to properly close things out.
Regards,
Brett
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
