Array and table Ui problem

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

Maybe this example will help

[{"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}]
1 Like

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.

Reverse the array

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

1 Like

Thank you E1cid, all working fine!

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