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.
Discussion posts and replies are publicly visible
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.
Current Existing framework is a paragraph field, which will be in read only and editable mode based on a checkbox selection by user. So the legacy data which we have in DB has html stuff in it. User when clicks edit mode, that data needs editable and I need to represent it properly. So I cannot use this rich text plugin, Where rich text field is not editable.
Below a simple way to substitute multiple string in one go. Just add any missing HTML entity and its replacement. Perform this to cleanup when loading the data.
a!localVariables( local!html: "I’m Appian resource. Any other existing–resource?", reduce( substitute(_,_,_), local!html, merge( {"& n d ash;", "& n b sp;", "& r s quo;"}, {"-", " ", "'"} ) ) )
I had to add some spaces to the HTML entities to please this editor here.
Right now I am using same thing from yesterday, but how many we can include by seeing one by one 90k+ records. Yesterday I did some random search in DB and able to add few character sets. But there are Many. Looking something smarter.There is also one more issue as per current Appian Documentation for the stripHtml() function. It mentions "Changes the provided HTML string into a plain text string by converting <br>, <p>, and <div> to line breaks, stripping all other tags, and converting escaped characters into their display values" But It is just adding space, not 'New line'
<br>
<p>
<div>