# List of string on dashboard

**URL:** <https://discourse.nodered.org/t/list-of-string-on-dashboard/69932>\
**Category:** Dashboard\
**Created:** [2 November 2022 07:40 UTC](https://discourse.nodered.org/t/list-of-string-on-dashboard/69932 "2022-11-02T07:40:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denissanga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/denissanga/32/48346_2.png) [@denissanga](https://discourse.nodered.org/u/denissanga)\
**Post date:** [2 November 2022 07:40 UTC](https://discourse.nodered.org/t/list-of-string-on-dashboard/69932/1 "2022-11-02T07:40:35Z")

</div>

Hi all, I'm working with dashboard and I would like create a text output of a payload composed by many string. Each string had to be shown in different lines. it is possible?

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [2 November 2022 14:20 UTC](https://discourse.nodered.org/t/list-of-string-on-dashboard/69932/2 "2022-11-02T14:20:25Z")

</div>

Yes it is -- once you understand that Dashboard uses Angular to generate HTML elements, you can use many techniques e.g. put your multi-line text inside `<pre>` tags, or use CSS styling to show a pre-formatted paragraph, or replace newlines with `<br>` tags, etc.

Check out [this old post](https://discourse.nodered.org/t/help-with-displaying-text-log/37333) for some other ideas.

---

<div class="post-metadata">

**Author:** ![juanbal](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@juanbal](https://discourse.nodered.org/u/juanbal)\
**Post date:** [3 November 2022 20:08 UTC](https://discourse.nodered.org/t/list-of-string-on-dashboard/69932/3 "2022-11-03T20:08:12Z")

</div>

Hello  
take a look at this sample flow and check if it works for you.  
If you need your log to persists restarts, you'll need to use [persistent context](https://nodered.org/docs/user-guide/context).

I got this flow in this forum not long ago, but I don't know who is the original author.  
Sorry for not giving credit.

```auto
[{"id":"c4dd74857a35dbd2","type":"function","z":"58ade23330ac7d0c","name":"Collect outages","func":"// Get the previously stored commands\nvar temp = context.get(\"outages\") || [];\n\n// Prepare date for log\nvar tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds\nvar localISOTime = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -5);\n\nif (msg.topic===\"--ClearList--\") {\n // Clear the current list\n temp = [];\n context.set(\"outages\", temp);\n} else {\n // Add the new one \n temp.push(localISOTime + \" - \" + msg.payload);\n context.set(\"outages\", temp);\n}\n\n//Format the output\nmsg.payload = \"\";\nfor (var i=0; i<temp.length; i++) {\n msg.payload += temp[i] + \"<br/>\";\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":395,"y":240,"wires":[["02d70773c4455783"]],"l":false},{"id":"02d70773c4455783","type":"ui_template","z":"58ade23330ac7d0c","group":"6caa64be625d6e00","name":"Outage log","order":4,"width":9,"height":6,"format":"<div ng-bind-html=\"msg.payload\" height=\"300\" style=\"height: 400px;\"><br/></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":495,"y":240,"wires":[[]],"l":false},{"id":"f04abe539adb8c18","type":"inject","z":"58ade23330ac7d0c","name":"Log data","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":280,"y":240,"wires":[["c4dd74857a35dbd2"]]},{"id":"15c52f83316ddbc3","type":"ui_button","z":"58ade23330ac7d0c","name":"","group":"6caa64be625d6e00","order":1,"width":0,"height":0,"passthru":false,"label":"Clear","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"--ClearList--","payloadType":"str","topic":"--ClearList--","topicType":"str","x":290,"y":200,"wires":[["c4dd74857a35dbd2"]]},{"id":"6caa64be625d6e00","type":"ui_group","name":"Status","tab":"1bacbfa2076f613b","order":1,"disp":false,"width":15,"collapse":false,"className":""},{"id":"1bacbfa2076f613b","type":"ui_tab","name":"UPS","icon":"fa-battery-three-quarters","order":10,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 December 2022 20:08 UTC](https://discourse.nodered.org/t/list-of-string-on-dashboard/69932/4 "2022-12-03T20:08:44Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
