Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sfloberg
Partner - Contributor III
Partner - Contributor III

Remove HTML-code from database

I read data to a Qlik Sense application from a database that is populated by a textbox. The user can make the text bold and so on.

Is there any way to remove the HTML-code from the content? I don't want the HTML tags in my field in the Qlik Sense application.

1 Reply
petter
Partner - Champion III
Partner - Champion III

This script snippet can give you an idea on how you can dynamically populate a mapping table with HTML tags and use that with MapSubstring() to strip them out:

TEST:

LOAD RecNo() AS RecNo,

html_field

INLINE [

html_field

'<body><p>Hello!</p><p></p><p>DATA TEST DATA TEST </p><p></p><p>TESTING THIS OTHER SEGMENT.</p><p> also this one in lower case</p><p></p><p>lots of different types of html tags <span test="test" __test_macro="testmac" class="test_macro" src="test.gif"></span></p></body>'

];


HTML_TAG_MAP:

MAPPING LOAD DISTINCT

'<' & TextBetween('<' & SubField(html_field, '<'),'<','>') & '>' AS HtmlTag,

'' AS Substitute

RESIDENT

  TEST;


JOIN (TEST)

LOAD

  RecNo,

  MapSubstring('HTML_TAG_MAP', html_field) as Field_Cleansed

RESIDENT

  TEST

ORDER BY

  RecNo;


This script was created by someone else in this thread: Removing HTML markup code which did this for QlikView...

I tested it in Qlik Sense and it works equally well there.