Variable in ui Table

Hi, i have a ping node which gives me an online or offline value for the appropriate ip address of the device.
Now i want to display this online or offline value in the ui_table (json formatted inject node), but I don't know how to code this.

Please advise.

[{"id":"c7374ff9.059fd8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"5817a1ca.2f84a","type":"ping","z":"c7374ff9.059fd8","name":"minirouter (192.168.1.1)","host":"192.168.1.1","timer":"20","x":290,"y":240,"wires":[["b652f75b.8700e"]]},{"id":"83a869be.6eddc8","type":"debug","z":"c7374ff9.059fd8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1050,"y":240,"wires":[]},{"id":"4f1b85ea.5eef1c","type":"inject","z":"c7374ff9.059fd8","name":"","topic":"","payload":"[{\"device\":\"Router\",\"ipaddress\":\"192.168.1.1\",\"status\":\"online\",\"url\":\"http://192.168.1.1\",\"aktion_1\":\"\",\"aktion_2\":\"\"},{\"device\":\"Sonoff Pow R2\",\"ipaddress\":\"192.168.1.196\",\"status\":\"online\",\"url\":\"http://192.168.1.196\",\"aktion_1\":\"\",\"aktion_2\":\"\"},{\"device\":\"Raspberry Pi\",\"ipaddress\":\"192.168.1.220\",\"status\":\"online\",\"url\":\"\",\"aktion_1\":\"Restart\",\"aktion_2\":\"Shutdown\"},{\"device\":\"Server\",\"ipaddress\":\"192.168.1.100\",\"status\":\"online\",\"url\":\"http://192.168.1.100\",\"aktion_1\":\"Wake on LAN\",\"aktion_2\":\"Shutdown\"}]","payloadType":"json","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":290,"y":400,"wires":[["2a61ce21.cef162"]]},{"id":"2a61ce21.cef162","type":"ui_table","z":"c7374ff9.059fd8","group":"6990021c.cb4f1c","name":"Device List","order":1,"width":14,"height":5,"columns":[{"field":"device","title":"Gerät","width":"150","align":"left","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"ipaddress","title":"IP Adresse","width":"120","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"status","title":"Status","width":"80","align":"center","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"url","title":"URL","width":"180","align":"left","formatter":"link","formatterParams":{"target":"_blank"}},{"field":"aktion_1","title":"","width":"100","align":"center","formatter":"link","formatterParams":{"target":"_blank"}},{"field":"aktion_2","title":"","width":"100","align":"center","formatter":"link","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":470,"y":400,"wires":[]},{"id":"d0153d0b.7f7f6","type":"comment","z":"c7374ff9.059fd8","name":"Network Device List","info":"","x":290,"y":340,"wires":[]},{"id":"b652f75b.8700e","type":"switch","z":"c7374ff9.059fd8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"lte","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":240,"wires":[["6a2b671e.739798"],["58c03eab.d428e"]]},{"id":"6a2b671e.739798","type":"function","z":"c7374ff9.059fd8","name":"online","func":"msg.payload = 'online'\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":220,"wires":[["3f02af01.c4236"]]},{"id":"58c03eab.d428e","type":"function","z":"c7374ff9.059fd8","name":"offline","func":"msg.payload = 'offline'\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":260,"wires":[["3f02af01.c4236"]]},{"id":"3f02af01.c4236","type":"function","z":"c7374ff9.059fd8","name":"","func":"minirouter = msg.payload\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":240,"wires":[["83a869be.6eddc8"]]},{"id":"6990021c.cb4f1c","type":"ui_group","z":"","name":"Default","tab":"bcbebf2b.5cc08","disp":false,"width":14,"collapse":false},{"id":"bcbebf2b.5cc08","type":"ui_tab","z":"","name":"Network","icon":"dashboard","order":8,"disabled":false,"hidden":false}]

Start by playing with theexamples that are provded with ui-table. If you go to Ui-table node example you can see how to get the examples.

Thanks, I know these examples, but I think this helps me not, because there are no variables but only values.
I want to get a variable from another node into the json inject node

You can not insert something into an inject node dynamically, but have you thought of connecting the ui-table note to the flow creating the data? You will probably need a change node to format the data info a format that the ui-table node needs and in the example nodes you have the format that is needed.

Alternatively, save to flow context in a change node (coming out of that other node)
Then inject from flow. with the variable you exported it to.

hmmm, sorry but I don't know what you mean, maybe you can show me in the flow I provided.

many Thanks

Here's some reading material to get you started: https://nodered.org/docs/user-guide/context#what-is-context. In your situation, go for the "using context in flow" with the change node. Put that after your ping node output and save it to the flow context.

Then in the inject wherever you need it, select flow. followed by the name of the flow variable you picked. For example:

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