Skip to main content
sushmar0011
Participating Frequently
February 16, 2023
Question

Current Appian striphtml() function only stripping html entity number for few, but html entity name still remains in the given text. Html Decode

  • February 16, 2023
  • 7 replies
  • 1 view

Do we have any Html decode function other than stripHtml? or any regex function to use ?

Example of My current String which I get from Portal and it will be saved in DB as

"I’m Appian resource.  Any other existing–resource?"

If I use striphtml("I’m Appian resource.  Any other existing–resource?")

I am getting same output -> "I’m Appian resource.  Any other existing–resource?"

If I use

reduce(
fn!substitute,
striphtml(ri!displayName),
merge({ "’", "–" }, { "'", "-" })
)

Then I will get proper result -> "I'm Appian resource.  Any other existing-resource?"

But I can't predict only 2 html entity names. There are many, that I need to convert and display in a!paragraph field.

7 replies

adityag9712
February 16, 2023

fromhtml()

sushmar0011
Participating Frequently
February 16, 2023

fromHtml() is depricated, which will be replaced by stripHtml()

gayathris111098
February 16, 2023

Make use of the plugin 'RichText Tools' (present at community.appian.com/.../rich-text-editor) and make sure that the HTML tags are replaced with the contents which represent a format as per the plugin. You need to convert HTML content into a format in such a way that it's readable by Rich Text Display Field SAIL component.

gayathris111098
February 16, 2023

a!localVariables(
/* remove the initial "p tags"*/
local!strippedText: ri!textToConvert,
/* strip "p" tag from stand alone "br" tags */
local!strippedText2: substitute(
local!strippedText,
"<br></p><p>",
"<br>"
),
/* knock out the ending "p" tags */
local!strippedText3: substitute(local!strippedText2, "</p>", ""),
/*replace list end tags */
local!strippedText4: substitute(local!strippedText3, "</ul><p>", "</ul>"),
local!strippedText5: substitute(local!strippedText4, "</ol><p>", "</ol>"),
substitute(local!strippedText5, "<p>", "<br>"))

like above