Solved

Convert rich text to simple text (report designer)

  • 25 November 2020
  • 1 reply
  • 44 views

i tried to display the field “InventoryItem.Body” and i get a HTML return i just want to get only the values in the fields in report designer

icon

Best answer by Hughes Beausejour 25 November 2020, 17:54

I have a detailed answer for this question on Stack Overflow:

https://stackoverflow.com/a/59869303/7376238

 

The solution is to create a custom field and use the Html2PlainText helper method to extract the text content from the HTML field (body):

#region DescriptionAsPlainText
public abstract class descriptionAsPlainText : PX.Data.BQL.BqlString.Field<descriptionAsPlainText> { }

private string _plainText;
[PXString(IsUnicode = true)]
[PXUIField(Visible = false)]
public virtual String DescriptionAsPlainText
{
    get
    {
        return _plainText ?? (_plainText = PX.Data.Search.SearchService.Html2PlainText(this.Description));
    }
}
#endregion

View original

1 reply

Userlevel 3

I have a detailed answer for this question on Stack Overflow:

https://stackoverflow.com/a/59869303/7376238

 

The solution is to create a custom field and use the Html2PlainText helper method to extract the text content from the HTML field (body):

#region DescriptionAsPlainText
public abstract class descriptionAsPlainText : PX.Data.BQL.BqlString.Field<descriptionAsPlainText> { }

private string _plainText;
[PXString(IsUnicode = true)]
[PXUIField(Visible = false)]
public virtual String DescriptionAsPlainText
{
    get
    {
        return _plainText ?? (_plainText = PX.Data.Search.SearchService.Html2PlainText(this.Description));
    }
}
#endregion

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved