Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pawwy1415
Creator III
Creator III

Purgechar function help

Hi,

Can any one please help me on below requirement.

I have a Name field with below records.

Name

<p>A code that identifies the type of party that the postal address usage applies to.</p>

The name of the residential postal address country for the individual.

<div>A code that identifies the country of an organisation operating address.</div>

<p style="font-size: 12.0px;"><span style="font-size: 13.0px;">A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.<br/></span></p>

 

Expected Output:

Name

A code that identifies the type of party that the postal address usage applies to.

The name of the residential postal address country for the individual.

A code that identifies the country of an organisation operating address.

A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.

 

I have tried this logic to avoid<p> </p> but its removing p letter in the middle of text also.

PurgeChar(Name,'<,>,/,#,p')

I there any other way to handle this scenario. Please help me on this.

Thanks in advance.

 

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

if it's on Qlikview:
I suggest you add a javascript macro :

function dropTags(row) {
 return row.replace(/<[^>]*>/gi, "");
}


then in load script :

Data:

load dropTags(Name) as clean_JS,* inline [
Name
<p>A code that identifies the type of party that the postal address usage applies to.</p>
The name of the residential postal address country for the individual.
<div>A code that identifies the country of an organisation operating address.</div>
<p style="font-size: 12.0px;"><span style="font-size: 13.0px;">A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.<br/></span></p>
];

if you can't use Macro , you can Add Mapping table 

so on load script :

map2:
mapping LOAD * 
Inline [
Name, Clean
<p>,
<div>,
<p style="font-size: 12.0px;">,
<span style="font-size: 13.0px;">,
</p>,
</div>,
<br/></span></p>,

] ;

Data:

load MapSubString('map2', Name) as clean_Mapping,* inline [
Name
<p>A code that identifies the type of party that the postal address usage applies to.</p>
The name of the residential postal address country for the individual.
<div>A code that identifies the country of an organisation operating address.</div>
<p style="font-size: 12.0px;"><span style="font-size: 13.0px;">A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.<br/></span></p>
];

here the results of both approaches

Capture.PNG

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

if it's on Qlikview:
I suggest you add a javascript macro :

function dropTags(row) {
 return row.replace(/<[^>]*>/gi, "");
}


then in load script :

Data:

load dropTags(Name) as clean_JS,* inline [
Name
<p>A code that identifies the type of party that the postal address usage applies to.</p>
The name of the residential postal address country for the individual.
<div>A code that identifies the country of an organisation operating address.</div>
<p style="font-size: 12.0px;"><span style="font-size: 13.0px;">A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.<br/></span></p>
];

if you can't use Macro , you can Add Mapping table 

so on load script :

map2:
mapping LOAD * 
Inline [
Name, Clean
<p>,
<div>,
<p style="font-size: 12.0px;">,
<span style="font-size: 13.0px;">,
</p>,
</div>,
<br/></span></p>,

] ;

Data:

load MapSubString('map2', Name) as clean_Mapping,* inline [
Name
<p>A code that identifies the type of party that the postal address usage applies to.</p>
The name of the residential postal address country for the individual.
<div>A code that identifies the country of an organisation operating address.</div>
<p style="font-size: 12.0px;"><span style="font-size: 13.0px;">A code that identifies the country where an entity is registered to operate, in accordance with the rules set forth by the regulatory body that grants the registration.<br/></span></p>
];

here the results of both approaches

Capture.PNG

 

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
pawwy1415
Creator III
Creator III
Author

Great Solution...

Thanks alot for your help.