Function new line

Hi,

I made a function that creates the content for a dashboard text node.
This function works great!
But i like to have some newlines between some of the content parts when showing the info on the dasboard, is that possible?

I tried to '/n' at some places in the payload string but that did not work

msg.payload = 'Server: ' + msg.server + ' is NIET beschikbaar'

if(msg.run)
{msg.payload = msg.payload + ' en krijgt OScommand: ' + msg.oscmd + ', iD: ' + msg.devid + ', Counter:' + msg.teller + '/' + msg.repetitions + ', Errors:' + msg.tellererror;}
else
{msg.payload = msg.payload + ', iD: ' + msg.devid + ', Counter:' + msg.teller + '/' + msg.repetitions + ', Errors:' + msg.tellererror;}

if(msg.notifyok)
{msg.payload = msg.payload + '. Notificatie wordt verzonden naar: ' + msg.device;}

else if (msg.notifynok)
{msg.payload = msg.payload + '. Notificatie wordt verzonden naar: ' + msg.device;}

else
{}

return msg;

Wrap each "line" (paragraph really) with <p>....</p> or <div>...</div>

Or, if you really only need a line break, add <br> at the end of the line.

Your template output needs to be HMTL.

Thanks!
I will try it!

Also newline is \n not /n

1 Like

It Works with the

option, thanks to all!
Will also try <\n>

it works with <br>. use \ to esacpe < so it renders on screen, so \<br>
but do not use <\n> just \n

Thanks! works perfect!

if payload contains newlines like "hello\nworld\n\tnodered!"

<pre>{{msg.payload}}</pre>

should show it verbatim on text UI widget