Skip to main content
May 18, 2022
Question

Extract text value from Rich Text Editor saved value

  • May 18, 2022
  • 4 replies
  • 0 views

Hi Team,

I have a rich text editor in my interface and its value is saved as "text" in DB with all the tags (that includes bullets, colors, background color, highlight etc ).

I want to extract only the text part of the data.

How can I do this?

Like if the value is saved as "<div>Assigned to <em style="color: rgb(0, 71, 178);">XYZ</em></div>" , I only want "Assigned to XYZ".

striphtml() function throws error.

Appian version 21.1

    4 replies

    stefanhelzle0001
    Brainy
    May 18, 2022

    Your example works flawless with striphtml().

    Why do you use a richtextfield in the first place?

    May 18, 2022

    Hi Stefan,
    We have to give the privilege to the users to write comments. Comments can be in form of bulleted list, numbered list, bold characters at places and anything else that the user feels is important.

    When I use striphtml("<div>Assigned to <em style="color: rgb(0, 71, 178);">XYZ</em></div>") in Expression rule I get the below error : 
    Expression evaluation error: Syntax error. Details: Expression evaluation error at function 'striphtml' parameter 2 [line 70]: The Target is missing.

    Also the value will be extracted from DB table using a!queryentity.

    stewart.burchell
    May 18, 2022

    If you're constructing your expression rule literally as:

    then, yes, you'll get a syntax error as the expression editor is trying to parse all of the quote characters and failing.

    If you pass the value into your expression in a rule input:

    then, as [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] says, it works perfectly.

    If you fetch the data using a query as you're suggesting then it'll work fine too.