Home > Forum > Rules, JS, SQL > SQL Command in Business Rule removes line breaks (CR-LF)

SQL Command in Business Rule removes line breaks (CR-LF)
0

MVP

Hey everyone! Is there a way to keep line breaks (CR-LF) in the output of the SQL Command used in a Business Rule? I'm selecting values from DET_LongText1 which has line breaks. I'm attaching 3 images to show what I mean.

1. Webcon Form: What I see on the frontend.
2. Notepad++: What I see in Notepad++.
3. Output: What I see in the email if I output the value of the field with a Business Rule.

I can't output the form field directly because it is coming from an Item List.

Do you have any ideas what could I do to have line breaks in the output?

Thank you,
Martin

MVP

Hi Martin,

is this a normal text field or rich text?
The value looks like a normal one. In this case you have two options.
a) Add some css so that the line breaks are preserved inside the HTML mail. In most cases they are ignored.
b) Replace the Character 10 and 13 with the HTML line break <br/>

REPLACE (MyField, CHAR (13) + CHAR (10), '<br/>')

I haven't shamelessly copied the above and haven't tested it myself.

Best regards,
Daniel

MVP
In reply to: Martin Meze (Freelancer)

Hi Daniel! Thank you for the ideas. I’d prefer the css approach but I’m afraid the line breaks are removed from the text when the business rule is executed. I’m currently at the beach 😝 so will check later when back at the PC.

I'm currently sitting in the train travelling to Münster and the internet connection is like a sidescrolling game where you jump to evade obstacles. It's quite fast and every time you hit one, the internet connection is down. :)


It's interesting that the business rule removes the html tags. I now that a special function has been added to achieve exactly this. So I would have assumed that an SQL Command would return the value as is.

Regarding the css this is the property:
https://www.w3schools.com/cssref/pr_text_white-space.asp

Best regards,
Daniel