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
Convert rich text to simple text (report designer)
Best answer by Hughes Beausejour
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.