# Stuck making lists on dashboard

**URL:** <https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757>\
**Category:** Dashboard\
**Created:** [2 June 2019 00:36 UTC](https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757 "2019-06-02T00:36:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2019 00:36 UTC](https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757/1 "2019-06-02T00:36:23Z")

</div>

I know I have "been down this path before" but I have since learned more and am stuck at another part of the journey.

I have found this ability to make "lists" on the screen.

It is a `ui_template` node and the code is:

```auto
<table id="table" border="1">
 <tr>
 <th>Front door events</th> 
 </tr>
 <tbody>
 <tr ng-repeat="row in msg.payload track by $index">
 <td class="text" >{{row}}</td>
 </tr>
 </tbody>
</table>

```

I was stuck with this in another way recently but that isn't applicable to the latest task I have.

At random times things will happen.

I want to create a list of them - say 10 lines big - and show the last 10 events.

As they come in, they are formatted and sent to this node and displayed.

Alas as is, this has no _memory_ and so every new event is shown and the previous one wiped.

What I am needing is an array that keeps the last 10 events and when a new one comes in, it _shuffles_ them down one place and sticks the latest one on the queue and re-sends the entire list. I'm guessing.

That would require a `function` node I also guess.

There aren't any nodes that do this already are there?

I can't seem to resolve any from my search, but it somewhat depends on how the node is described by the person writing it and what I make of it.

Thanks.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2019 01:06 UTC](https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757/2 "2019-06-02T01:06:24Z")

</div>

This is what I have bashed up (with work in progress)

```auto
var new_msg = msg.payload[0];
//node.warn("Incoming message is " + new_msg);
var topic = "Main door events";
// Set up stack for old messages.
var message1 = context.get("message1");
var message2 = context.get("message2");
var message3 = context.get("message3");
var message4 = context.get("message4");
var message5 = context.get("message5");
var message6 = context.get("message6");
var message7 = context.get("message7");
var message8 = context.get("message8");
var message9 = context.get("message9");

if (msg.wipe === 1)
{
    //
    // Wipe all messages.
    // (work needed)
}

message9 = message8;
message8 = message7;
message7 = message6;
message6 = message5;
message5 = message4;
message4 = message3;
message3 = message2;
message2 = message1;
message1 = new_msg;

context.set("message1",message1);
context.set("message2",message2);
context.set("message3",message3);
context.set("message4",message4);
context.set("message5",message5);
context.set("message6",message6);
context.set("message7",message7);
context.set("message8",message8);
context.set("message9",message9);

//node.warn(message1);
//node.warn(message2);
//node.warn(message3);

msg = {"topic":topic,"payload":[message1,message2,message3,message4,message5,message6,message7,message8,message9]};
return msg;

```

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [2 June 2019 02:20 UTC](https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757/3 "2019-06-02T02:20:20Z")

</div>

I think you will find this node very handy for the purpose: `node-red-contrib-ring-buffer`

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 June 2019 02:33 UTC](https://discourse.nodered.org/t/stuck-making-lists-on-dashboard/11757/4 "2019-06-02T02:33:51Z")

</div>

I have made more progress on the `function` node getting it working.

But I will look at it.

Thanks.
