# Array and table Ui problem

**URL:** <https://discourse.nodered.org/t/array-and-table-ui-problem/82492>\
**Category:** General\
**Created:** [31 October 2023 13:24 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492 "2023-10-31T13:24:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MA.ING](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MA.ING](https://discourse.nodered.org/u/MA.ING)\
**Post date:** [31 October 2023 13:24 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/1 "2023-10-31T13:24:35Z")

</div>

Hi,

I restarted node red node again and I'm lost after so long, Im trying to represent a machine state in a table, i have one array:

* * *

msg.payload : array[3]

array[3]

0: "2023-10-31T14:17:02.515Z"

1: "Start"

2: "4"

* * *

How can i represent this array in ui table? The problem is that i dont have only one object in the array?

Thanks in advance.  
Regards

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [31 October 2023 16:23 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/2 "2023-10-31T16:23:13Z")

</div>

Maybe this example will help

```auto
[{"id":"566c17275d3f7d3e","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"2023-10-31T14:17:02.515Z\",\"Start\",\"4\"]","payloadType":"json","x":110,"y":4820,"wires":[["c51368d20c9a4fc9"]]},{"id":"c51368d20c9a4fc9","type":"template","z":"b779de97.b1b46","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"[\n {\n \"date\": \"{{{payload.0}}}\",\n \"state\": \"{{{payload.1}}}\",\n \"value\": {{{payload.2}}}\n }\n]","output":"json","x":280,"y":4820,"wires":[["468f19b92a6fe741","24c6aa245669f02a"]]},{"id":"468f19b92a6fe741","type":"ui_table","z":"b779de97.b1b46","group":"4f791fdc1745d3d9","name":"","order":8,"width":0,"height":0,"columns":[{"field":"date","title":"Date","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"state","title":"State","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"value","title":"Value","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":430,"y":4820,"wires":[]},{"id":"24c6aa245669f02a","type":"debug","z":"b779de97.b1b46","name":"debug 347","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":430,"y":4760,"wires":[]},{"id":"4f791fdc1745d3d9","type":"ui_group","name":"micro","tab":"c954274bbed7292e","order":1,"disp":false,"width":"18","collapse":false,"className":""},{"id":"c954274bbed7292e","type":"ui_tab","name":"Solar","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![MA.ING](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MA.ING](https://discourse.nodered.org/u/MA.ING)\
**Post date:** [2 November 2023 10:48 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/3 "2023-11-02T10:48:19Z")

</div>

Thank you so much E1cid, its work so fine!

One question more, if i read a csv to represent in a dashboard table, how can i do to have the last csv row in first table position (reverse the order of the csv in the table, see first in table the last row saved in csv)?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [2 November 2023 15:09 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/4 "2023-11-02T15:09:04Z")

</div>

Reverse the array

> **[Array Functions · JSONata](https://docs.jsonata.org/array-functions#reverse)**
>
> \## \`$count()\`

In a change node  
set `msg.` `payload`  
to value of `J:` `$reverse($$.payload)`

---

<div class="post-metadata">

**Author:** ![MA.ING](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MA.ING](https://discourse.nodered.org/u/MA.ING)\
**Post date:** [3 November 2023 08:46 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/5 "2023-11-03T08:46:16Z")

</div>

Thank you E1cid, all working fine!

---

<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:** [17 November 2023 08:46 UTC](https://discourse.nodered.org/t/array-and-table-ui-problem/82492/6 "2023-11-17T08:46:48Z")

</div>

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