Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
3 years ago

How can extract just the text from a rich text field?

I have a rich text field that looks like below (a snip from it)

If(
[Rejected/Cancelled]=true, "<div style=\"font-weight:bold; font-size:14px;padding-left: 5px;padding-right: 5px; padding-top: 10px;padding-bottom: 10px; text-align: center; background-color:#f5fca2;\"> Rejected/Cancelled</div>",

[Approval Not Required]=true,"<div style=\"font-weight:bold; font-size:14px;background-color:#4E6EC19;\"> No Approval Required</div>",

[Most Recent Admin Final Approval]="Approved","<div style=\"font-weight:bold; font-size:14px;padding-left: 5px;padding-right: 5px; text-align: center;background-color:#4FB770;\"> Sent to AP for Processing</div>".....etc)

I need the actual text (ie 'Reject/Cancelled, No Approval Required, etc) extracted for form rules and other reasons.

However, if I mirror the field as a test to see what QB sees, an example of the result is:

<div style="font-weight:bold; font-size:14px;padding-left: 5px;padding-right: 5px; text-align: center;color:black; background-color:#E74C3C;"> Manager Sign & Approve</div>

Essentially, it shows literally what is in the Rich Text field. Is my only option to duplicate the field exactly, but remove the formatting? I was hoping I can reference the field in some way, so that if I change my if/then rules in the future, I don't have to change them in two spots. Any sneaky way to reference a Rich Text field and have it return only the text?



------------------------------
Mike Tamoush
------------------------------

2 Replies

  • Hi Mike,

    Hope you are doing well.

    You can use the below formula for the same. Just replace my [Your Rich Text Field] field with your actual rich text field.

    Left(Part([Your Rich Text Field],2,">"),"<")

    The above formula will extract only text. Try this out and let me know if this works for you in this case.

    Thanks,



    ------------------------------
    Gaurav Sharma
    Business Application Architect
    Westhaven Power, Inc
    +91-8826743679
    ------------------------------
    • MichaelTamoush's avatar
      MichaelTamoush
      Qrew Captain
      I haven't tried, but OF course! Good idea to parse it out like that.

      ------------------------------
      Mike Tamoush
      ------------------------------