Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gsethuraman2
Contributor III
Contributor III

Need to remove special character from variable == > need to remove '

let vPerson_Name="NEILO'BERG";

vPerson_Name=KeepChar(vPerson_Name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
Trace $(vPerson_Name);

let vPerson_Name1="TERRYO'BERG";

vPerson_Name1=PurgeChar(vPerson_Name1,"'");
Trace $(vPerson_Name1);

 

But its not working vPerson_Name and vPerson_Name1 both not getting NEILOBERG

1 Solution

Accepted Solutions
mahaveerbiraj
Creator II
Creator II

Hi ,

Then That is Just reverse the logic 

for column level just remove char and take peek value from new column. I mean using below expression remove "'"  from column   

KeepChar(vPerson_Name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ')  as  PERSON_NAME_NEW

and Take  Peek of the new column  PERSON_NAME_NEW

like 

let vPERSON_NAME = (peek('PERSON_NAME'));

View solution in original post

5 Replies
ychkojima
Partner - Contributor
Partner - Contributor

Hi!

How about using "Set" instead of "Let"?

mahaveerbiraj
Creator II
Creator II

Hi ,

Please try like below, Using Set for Initial Variable because we are not doing any calculation or Expression there , So its just Text better to use Set for String( Text)  

Set vPerson_Name="NEILO'BERG";

vPerson_Name=KeepChar(vPerson_Name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
Trace $(vPerson_Name);

gsethuraman2
Contributor III
Contributor III
Author

Actually i need to get the data from database so only using LET variable as below ..

let vPERSON_NAME = (peek('PERSON_NAME'));

So trying to assign let Variable to SET and trying to get rid of special character .. but as you mentioned above if using set then its working ,.. its just treat as String  .. but how to acheive in this scenario .. 

 

// Set vPerson_Name="NEILO'BERG";  Working 

// Let vPerson_Name="NEILO'BERG";  Not working (Need to get data from Database so only using LET var)

 

 

mahaveerbiraj
Creator II
Creator II

Hi ,

Then That is Just reverse the logic 

for column level just remove char and take peek value from new column. I mean using below expression remove "'"  from column   

KeepChar(vPerson_Name,'ABCDEFGHIJKLMNOPQRSTUVWXYZ')  as  PERSON_NAME_NEW

and Take  Peek of the new column  PERSON_NAME_NEW

like 

let vPERSON_NAME = (peek('PERSON_NAME'));

gsethuraman2
Contributor III
Contributor III
Author

let vPERSON_NAME= KeepChar(peek('PERSON_NAME',$(i),'ApplicationVariables1'),'ABCDEFGHIJKLMNOPQRSTUVWXYZ');

 

 

yes it worked ..thanks