# Problem updating UI-Table

**URL:** <https://discourse.nodered.org/t/problem-updating-ui-table/78565>\
**Category:** Dashboard\
**Tags:** node-red-dashboard, function-node\
**Created:** [21 May 2023 07:44 UTC](https://discourse.nodered.org/t/problem-updating-ui-table/78565 "2023-05-21T07:44:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [21 May 2023 09:12 UTC](https://discourse.nodered.org/t/problem-updating-ui-table/78565/2 "2023-05-21T09:12:04Z")

</div>

I believe the issue is when you try to add a row, best use the command function addRow , there is info in the help text, there are also example flows in the import examples.

here is an example, i have hardcoded the incoming values, so you will need to edit

```auto
[{"id":"f772e294cac42fef","type":"ui_ui_control","z":"b9860b4b9de8c8da","name":"","events":"connect","x":100,"y":2960,"wires":[["4830d675874b086f"]]},{"id":"4830d675874b086f","type":"change","z":"b9860b4b9de8c8da","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"savedData","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":2960,"wires":[["57590ede03d46c80"]]},{"id":"57590ede03d46c80","type":"ui_table","z":"b9860b4b9de8c8da","group":"2d4fe667.28f8ba","name":"","order":24,"width":0,"height":0,"columns":[],"outputs":0,"cts":false,"x":410,"y":3020,"wires":[]},{"id":"1340d3a79960f451","type":"function","z":"b9860b4b9de8c8da","name":"function 25","func":"let distanceFromBle = Math.pow(10, (-54 - (Math.random()*20)) / (10 * 3.5)).toFixed(1);\n\nlet tableData = flow.get(\"savedData\") || [];\nlet new_row = {\n \"bmac\": tableData.length,\n \"apmac\": 2,\n \"mymac\": 2,\n \"ltime\": 2,\n \"wrssi\": 2,\n \"brssi\": 2,\n \"distance\": distanceFromBle\n};\n\ntableData.unshift(new_row);\nif (tableData.length > 9) tableData.pop();\n\nmsg.payload = {\n command: \"addRow\",\n arguments: [\n new_row,\n true\n],\n returnPromise: true\n}\n\nflow.set(\"savedData\", tableData);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":250,"y":3060,"wires":[["57590ede03d46c80","c896bb713eec327c"]]},{"id":"14ac1f7d6efe1fa3","type":"inject","z":"b9860b4b9de8c8da","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"one\":1,\"two\":2},{\"one\":4,\"two\":5}]","payloadType":"json","x":90,"y":3040,"wires":[["1340d3a79960f451"]]},{"id":"c896bb713eec327c","type":"debug","z":"b9860b4b9de8c8da","name":"debug 297","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":470,"y":3080,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false,"className":""},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

[edit] Added Ui-control to load table on connect.

---

_[View the full topic](https://discourse.nodered.org/t/problem-updating-ui-table/78565)._
