This topic contains 4 replies, has 0 voices, and was last updated by ERPExperts 6 years, 8 months ago.
-
AuthorPosts
-
March 12, 2018 at 2:51 am #22557
FerdinandHello,
In one of our saved searches (transactions / purchase orders), I need to include a custom body field of type text area in the search results.
It works except that all line breaks are replaced by single spaces, i.e.
"Line 1
Line 2"
Will be shown as
"Line 1 Line 2"
Is there a way (e.g. using Formula(text) with certain functions) to preserve the line breaks?
I am using the search results for printing as Advanced PDF/HTML and losing the line breaks messes up the layout.
Thanks for any hints!
This is a cached copy. Click here to see the original post. -
March 12, 2018 at 7:48 am #22558
rnedelkowSuiteAnswer 37231 provides this example:
<br> tags are HTML codes, these are not considered for Formulas and will result in unexpected errors.
Should Line breaks be needed for Formula Fields, the tags below will work.
‘< br >’
This is applicable for Custom Fields or Formula Fields in Saved Searches.
Example:
{field1}|| ‘< br >’ || {field2}
Actual Result:
Field1
Field2
Ferdinand replied on 03/12/2018, 08:08 AM: Hello medelkow, thank you for your reply!
Unfortunately that doesn’t solve my problem. I’m not trying to manually introduce new line breaks (e.g. put a line break between two different fields) but get back the line breaks that should be contained in the text area field. Those are lost when listing the field’s contents as search result.
-
March 12, 2018 at 8:58 am #22559
ERPExpertsHi Ferdinand.
Do you essentially require the ability to find "n" and replace with "<br>"?
Ferdinand replied on 03/13/2018, 01:17 AM: That’s what I thought and tried first, but matching n does not work – see below.
-
March 13, 2018 at 1:15 am #22560
FerdinandOkay, I finally found the solution myself. I am using a Formula (Text) column with below code:
Code:
REGEXP_REPLACE({custbody_internalmemo}, '[[:cntrl:]]{2}', '<br>')
Where {custbody_internalmemo} is the text area custom field on the transactions being searched.[rn]+ and similar whitespace match expressions did not work. It seems each line break in the text area field is replaced by 2 control characters when returned as saved search results. I did not find out what control characters these are, but the above function works.
Edit: I found that the same thing happens also for text area custom column fields, except there for some reason each line break is replaced by only 1 control character, not 2. The above code works for column fields after removing the {2} in the match expression.
-
March 21, 2018 at 2:38 am #22561
ERPExpertsOriginally posted by Ferdinand
View Post
Okay, I finally found the solution myself. I am using a Formula (Text) column with below code:
Code:
REGEXP_REPLACE({custbody_internalmemo}, '[[:cntrl:]]{2}', '<br>')
Where {custbody_internalmemo} is the text area custom field on the transactions being searched.[rn]+ and similar whitespace match expressions did not work. It seems each line break in the text area field is replaced by 2 control characters when returned as saved search results. I did not find out what control characters these are, but the above function works.
Edit: I found that the same thing happens also for text area custom column fields, except there for some reason each line break is replaced by only 1 control character, not 2. The above code works for column fields after removing the {2} in the match expression.
Excellent find! Thanks for this!
-
AuthorPosts
You must be logged in to reply to this topic.