Separating database objects on dashbard

Hello I am reading a database from dashboard & want to display on dashboard on some tabs ?How it is possible through node-red dashboard?how /I can seperate array of objects?

[{"id":"ee4af54b.e5e4c8","type":"inject","z":"37600b34.10de04","name":"read from database","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":186,"y":489,"wires":[["c4044e5c.fe7ba"]]},{"id":"f15eb3f1.f9f74","type":"fieldbus in","z":"37600b34.10de04","name":"Input1","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Jan 18 2018/18:37:45","MinExpectedNodeJSVersion":"8.9.3","ActNodeJSVersion":"8.15.1","ActNodeREDVersion":"0.19.6","selectedSignalPath":"input~receive_001~Sig_1","fieldbusObj":"4942edff.af1714","x":210,"y":140,"wires":[["383cd8e4.420da8","94d2fcb9.f9209"]]},{"id":"d75ee845.03a158","type":"fieldbus in","z":"37600b34.10de04","name":"Input2","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Jan 18 2018/18:37:45","MinExpectedNodeJSVersion":"8.9.3","ActNodeJSVersion":"8.15.1","ActNodeREDVersion":"0.19.6","selectedSignalPath":"input~receive_001~Sig_2","fieldbusObj":"4942edff.af1714","x":210,"y":200,"wires":[["1919240d.7515ac","94d2fcb9.f9209"]]},{"id":"383cd8e4.420da8","type":"debug","z":"37600b34.10de04","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":600,"y":180,"wires":[]},{"id":"1919240d.7515ac","type":"debug","z":"37600b34.10de04","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":610,"y":220,"wires":[]},{"id":"a17a38d6.235088","type":"fieldbus out","z":"37600b34.10de04","name":"Output1","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Jan 18 2018/18:37:45","MinExpectedNodeJSVersion":"8.9.3","ActNodeJSVersion":"8.15.1","ActNodeREDVersion":"0.19.6","selectedSignalPath":"output~send_001~Sig_1","fieldbusObj":"4942edff.af1714","x":640,"y":360,"wires":[]},{"id":"b7cb186c.04d978","type":"inject","z":"37600b34.10de04","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":370,"wires":[["12a7d83c.690c18"]]},{"id":"94d2fcb9.f9209","type":"influxdb out","z":"37600b34.10de04","influxdb":"850291.a835fd7","name":"Write value","measurement":"myValue","precision":"","retentionPolicy":"","x":590,"y":260,"wires":[]},{"id":"9abe59b0.293fc8","type":"fieldbus in","z":"37600b34.10de04","name":"Input3","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Jan 18 2018/18:37:45","MinExpectedNodeJSVersion":"8.9.3","ActNodeJSVersion":"8.15.1","ActNodeREDVersion":"0.19.6","selectedSignalPath":"input~receive_001~Sig_3","fieldbusObj":"4942edff.af1714","x":210,"y":260,"wires":[["94d2fcb9.f9209"]]},{"id":"a0b08833.c086d8","type":"fieldbus in","z":"37600b34.10de04","name":"Input4","FieldbusNodeVersion":"1.2.7","WrapperVersion":"1.2.7","WrapperCompileDate":"Jan 18 2018/18:37:45","MinExpectedNodeJSVersion":"8.9.3","ActNodeJSVersion":"8.15.1","ActNodeREDVersion":"0.19.6","selectedSignalPath":"input~receive_001~Sig_4","fieldbusObj":"4942edff.af1714","x":210,"y":300,"wires":[["94d2fcb9.f9209"]]},{"id":"6b08e85.6efa118","type":"debug","z":"37600b34.10de04","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":666,"y":489,"wires":[]},{"id":"42ff1da.a7ccae4","type":"comment","z":"37600b34.10de04","name":"Read from database (return last 5 min)","info":"","x":226,"y":449,"wires":[]},{"id":"c4044e5c.fe7ba","type":"influxdb in","z":"37600b34.10de04","influxdb":"850291.a835fd7","name":"READ DATABASE","query":"SELECT value FROM myValue WHERE time > now() - 1h limit 1000;","rawOutput":false,"precision":"","retentionPolicy":"","x":406,"y":489,"wires":[["6b08e85.6efa118"]]},{"id":"d3ebd25a.c0f92","type":"inject","z":"37600b34.10de04","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":80,"wires":[["1e409434.770dfc"]]},{"id":"5b1ff301.93ae4c","type":"debug","z":"37600b34.10de04","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":60,"wires":[]},{"id":"5c95c3a9.66b76c","type":"comment","z":"37600b34.10de04","name":"Create a database","info":"","x":150,"y":40,"wires":[]},{"id":"1e409434.770dfc","type":"influxdb in","z":"37600b34.10de04","influxdb":"850291.a835fd7","name":"CREATE DATABASE \"MyTest\"","query":"CREATE DATABASE MyTest","rawOutput":false,"precision":"","retentionPolicy":"","x":430,"y":80,"wires":[["5b1ff301.93ae4c"]]},{"id":"12a7d83c.690c18","type":"change","z":"37600b34.10de04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.value","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":380,"wires":[["a17a38d6.235088"]]},{"id":"4942edff.af1714","type":"fieldbus interface","z":"","availableStackName":"EtherNet/IP Adapter (version 2.12, build 5 revision 0): cifX0","interfaceComponents":"{\"fwName\":\"EtherNet/IP Adapter\",\"boardName\":\"cifX0\",\"fwVersionMajor\":2,\"fwVersionMinor\":12,\"fwVersionBuild\":5,\"fwVersionRev\":0,\"prtName\":\"EtherNet/IP\",\"className\":\"Adapter\",\"prtClassNumber\":10,\"commClassNumber\":5,\"channelNumber\":2,\"deviceNumber\":7660120,\"serialNumber\":21989}","clearOutputsOnDeploy":false,"traceFilePath":"/root/.node-red/node-fieldbus.log","traceLevelWrapper":"wrapper","traceLevelNode":"node"},{"id":"850291.a835fd7","type":"influxdb","z":"","hostname":"192.168.0.5","port":"8086","protocol":"http","database":"MyTest","name":"","usetls":false,"tls":""}]

Thanks
BR
Madhumat

I presume you want to display a line chart in the dashboard since the data you extract to the array is a time series data.

If this is the case you are halfway done.

In order to display you need an array with objects like below:

{"x" : timestamp , "y" : value}

So you need first to transform your array by replacing the string "time" by "x" and the string "value" by "y";

A second step is to build the msg.payload property in the specific format required by the ui_chart node.

If you read and understand the flow below you will do it easily.

[{"id":"833f4c67.fc11d","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"8efb05b5.21be98","type":"function","z":"833f4c67.fc11d","name":"Transform data","func":"msg.payload = [\n    {\"time\" : \"2019-06-03 15:00:11\", \"value\" : 30},\n    {\"time\" : \"2019-06-03 15:10:11\", \"value\" : 50},\n    {\"time\" : \"2019-06-03 15:30:11\", \"value\" : 10},\n    {\"time\" : \"2019-06-03 15:40:11\", \"value\" : 40},\n    {\"time\" : \"2019-06-03 15:50:11\", \"value\" : 20},\n    {\"time\" : \"2019-06-03 15:55:11\", \"value\" : 60}\n]\n\nlet data = [];\n\nfor (let element of msg.payload) {\n    data.push({\"x\":element.time, \"y\":element.value});\n}\n\nmsg.data = data;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":180,"wires":[["6d201692.ff85c8"]]},{"id":"7ebfd20f.39b27c","type":"inject","z":"833f4c67.fc11d","name":"","topic":"","payload":"go","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["8efb05b5.21be98"]]},{"id":"2e485205.73739e","type":"debug","z":"833f4c67.fc11d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"data","targetType":"msg","x":760,"y":180,"wires":[]},{"id":"6d201692.ff85c8","type":"function","z":"833f4c67.fc11d","name":"Chart Boilerplate","func":"msg.topic = \"Data set 1\"; \nseries = [];\ndata = [];\nlabels = [];\n\nseries.push(\"Field1\");\nlabels.push(\"Field2\");\ndata.push(msg.data);\n\nmsg.payload = [{\"series\":series, \"data\":data,\"labels\": labels}];\n\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":180,"wires":[["1fbe735.896d18d"]]},{"id":"1fbe735.896d18d","type":"ui_chart","z":"833f4c67.fc11d","name":"","group":"d4cc65a.8bf5b98","order":8,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":610,"y":180,"wires":[["2e485205.73739e"]]},{"id":"d4cc65a.8bf5b98","type":"ui_group","z":"","name":"Group 1","tab":"90c6a3a3.ea2ca","disp":true,"width":"10","collapse":false},{"id":"90c6a3a3.ea2ca","type":"ui_tab","z":"","name":"Tab1","icon":"dashboard","order":3}]

chart-03