Thanks for the fast response! Actually I was referring to your query of updating the ui table; you found a solution? I'm seeking the same answer.
I have used the "sending commands" example available on the import nodes tab, then I tweaked the code in the function node to suite my purpose. I recommend that you do the same as it will be easier for you to see what you need and you can work on the code for your function node that way.
Hi,
I have value in SQL i want show the value in table please explain the briefly ,
Thank you
santhosh
Hi,
I have value in SQL i want show the value in table please explain the briefly ,
Thank you
santhosh
This thread was about getting information from a file so your question does not seem appropriate for this thread. It would be better to start a new thread, and make sure you focus it on the problem you have, which appears to be either getting the data from a database or formatting it for display. Also say what you have tried so far.
The ui-table node expects an array of data - the mysql node generally produces an array of data - Most times you can just feed one into the other.
yes please if it possible i have the same issue i will be tankful @Munier if you shear the flow with us
Hi
Here it is.
[{"id":"53b9dcde.e4cdac","type":"tab","label":"HeatExchanger","disabled":false,"info":""},{"id":"f7143cf4.b6727","type":"ui_table","z":"53b9dcde.e4cdac","d":true,"group":"7641829.33f427c","name":"","order":1,"width":"17","height":"4","columns":[{"field":"id","title":"ID","width":"","align":"right","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"timestamp","title":"Timestamp","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"RM","title":"Raw Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"rv","title":"Reconciled Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"d","title":"Revision Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"sd","title":"Standard Deviation","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"V","title":"Vetisticā","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":770,"y":860,"wires":[["bed0442.37227b8"]]},{"id":"bed0442.37227b8","type":"debug","z":"53b9dcde.e4cdac","name":"response from ui-table","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1000,"y":860,"wires":[]},{"id":"8b6eb782.0e619","type":"comment","z":"53b9dcde.e4cdac","name":"update ui-table by passing the complete tableData as array","info":"","x":510,"y":280,"wires":[]},{"id":"a1803d15.6a8fc8","type":"function","z":"53b9dcde.e4cdac","name":"clearData","func":"\nmsg.payload={\n command:\"clearData\",\n arguments: [],\n returnPromise: true\n}\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":580,"wires":[["f7143cf4.b6727","cb819f98.3a089"]],"info":"# clear data\n\nunfortunately this command (currently) do not send a promise back! So we have to pass it directly to the table handler"},{"id":"56277db9.0a8ccc","type":"inject","z":"53b9dcde.e4cdac","name":"clear","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":540,"wires":[["a1803d15.6a8fc8"]]},{"id":"7cdea2d1.64eac4","type":"comment","z":"53b9dcde.e4cdac","name":"Erase all data by using clearData command","info":"","x":360,"y":500,"wires":[]},{"id":"436c5562.6045cc","type":"ui_button","z":"53b9dcde.e4cdac","name":"","group":"54e8096.e2d77f8","order":2,"width":0,"height":0,"passthru":false,"label":"Update","tooltip":"init table by passing the hole table array (default way)","color":"","bgcolor":"","icon":"","payload":"6","payloadType":"num","topic":"","x":120,"y":320,"wires":[["b2b1efb2.67af7"]]},{"id":"2f49ece2.a9b044","type":"ui_button","z":"53b9dcde.e4cdac","name":"","group":"54e8096.e2d77f8","order":4,"width":0,"height":0,"passthru":false,"label":"clear","tooltip":"clear all table data","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":150,"y":580,"wires":[["a1803d15.6a8fc8","5e4acc9a.2793ac"]]},{"id":"9d26e542.e502e","type":"inject","z":"53b9dcde.e4cdac","name":"format table","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":459,"wires":[["bab3369a.4bf648","db8cef59.3e17c8"]]},{"id":"df84e22a.350e9","type":"comment","z":"53b9dcde.e4cdac","name":"Format Table using ui_control","info":"","x":400,"y":700,"wires":[]},{"id":"62f433ad.0992a4","type":"debug","z":"53b9dcde.e4cdac","name":"clearData","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":620,"y":399,"wires":[]},{"id":"3174ac13.0072cc","type":"ui_button","z":"53b9dcde.e4cdac","name":"","group":"54e8096.e2d77f8","order":3,"width":0,"height":0,"passthru":false,"label":"format table","tooltip":"Formats the table using msg.ui_control","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":190,"y":400,"wires":[["bab3369a.4bf648","db8cef59.3e17c8"]]},{"id":"bab3369a.4bf648","type":"change","z":"53b9dcde.e4cdac","d":true,"name":"","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":18,\"tabulator\":{\"layout\":\"fitColumns\",\"movableColumns\":false,\"index\":\"id\",\"columns\":[{\"title\":\"Tagname\",\"field\":\"id\",\"formatter\":\"text\",\"headerTooltip\":\"id number act as row index\"},{\"formatterParams\":{\"outputFormat\":\"HH:mm:ss.SSS\",\"inputFormat\":\"x\",\"invalidPlaceholder\":\"(unknown)\"},\"title\":\"Timestamp\",\"field\":\"timestamp\",\"formatter\":\"datetime\",\"headerTooltip\":\"timestamp of last change\"},{\"title\":\"Raw Values\",\"field\":\"RM\",\"formatter\":\"payload.a[1]\",\"headerTooltip\":\"reconciled values of last change\"},{\"title\":\"Reconciled Values\",\"field\":\"rv\",\"formatter\":\"payload.a[1]\",\"headerTooltip\":\"reconciled values of last change\"},{\"title\":\"Revision Values\",\"field\":\"d\",\"headerTooltip\":\"Standard Deviation of last change\"},{\"title\":\"Standard Deviation\",\"field\":\"sd\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Vetistic\",\"field\":\"V\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"}]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":860,"wires":[["62f433ad.0992a4","f7143cf4.b6727"]]},{"id":"92e3427a.cf1898","type":"inject","z":"53b9dcde.e4cdac","name":"Update table","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["b2b1efb2.67af7"]]},{"id":"b2b1efb2.67af7","type":"file in","z":"53b9dcde.e4cdac","name":"","filename":"C:\\IMPL\\HeatExchanger\\MassBalancing.dta","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":450,"y":320,"wires":[["f644956.f5654e8","f8fb647b.038438"]]},{"id":"ea9e6863.cb85e8","type":"debug","z":"53b9dcde.e4cdac","name":"file data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1040,"y":319,"wires":[]},{"id":"f644956.f5654e8","type":"function","z":"53b9dcde.e4cdac","d":true,"name":"Main Function node","func":"msg.payload = msg.payload.replace(/(-?\\d+\\.\\d+E[-+]\\d+)/g,\nfunction(v) { return Number(v) });\n\npayload=msg.payload;\nvar n=payload.search(\"F1,\");\nmsg.n=n;\nvar sub=payload.slice(n);\n//msg.sub=sub.replace(/(\\r\\n|\\n|\\r)/gm, \"M\");\nsub=sub.split(\"\\n\");\nmsg.payload=[];\n\nvar l=(sub.length/2);\n\nfor (var i=0;i<l-1;i++)\n{\n var out={};\n var all={};\n var a=sub[i].split(\",\")\n var b=sub[i+l].split(\",\")\n out[\"RM\"]=parseFloat(a[1]) +parseFloat(b[1])\n \n out[\"rv\"]=a[1];//+a[ 0];\n out[\"d\"]=b[1];\n out[\"sd\"]=Math.sqrt(b[3]);\n out[\"V\"]=b[4];\n out[\"id\"]=b[0];//\"F\"+(i+1);\n\n out[\"timestamp\"]=Date.now();\n out[\"Error\"]= \"\"+i;\n\nmsg.payload.push(out);\n \n flow.set(\"all\",msg.payload);\n \n\n}\n\nmsg.sub=sub;\n flow.set(\"all\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":860,"wires":[["ea9e6863.cb85e8","f7143cf4.b6727"]]},{"id":"19f8fee1.b86bf9","type":"inject","z":"53b9dcde.e4cdac","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":120,"wires":[["10a6ce6.19b0132"]]},{"id":"10a6ce6.19b0132","type":"exec","z":"53b9dcde.e4cdac","command":"C:\\\\IMPL\\\\HeatExchanger.bat","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"","x":400,"y":119,"wires":[["d68ed2af.0d9cc8"],["20636c54.0ac0bc"],["f1d71fe2.91265"]]},{"id":"d68ed2af.0d9cc8","type":"debug","z":"53b9dcde.e4cdac","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":59,"wires":[]},{"id":"20636c54.0ac0bc","type":"debug","z":"53b9dcde.e4cdac","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":119,"wires":[]},{"id":"f1d71fe2.91265","type":"debug","z":"53b9dcde.e4cdac","name":"","active":false,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":710,"y":199,"wires":[]},{"id":"aa00d965.c9ec3","type":"comment","z":"53b9dcde.e4cdac","name":"Run the IML file in the background","info":"","x":410,"y":60,"wires":[]},{"id":"12f93252.7e8a16","type":"ui_button","z":"53b9dcde.e4cdac","name":"","group":"54e8096.e2d77f8","order":1,"width":0,"height":0,"passthru":false,"label":"Run the model","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":140,"y":180,"wires":[["10a6ce6.19b0132"]]},{"id":"5e4acc9a.2793ac","type":"exec","z":"53b9dcde.e4cdac","command":"C:\\IMPL\\HeatExchanger\\Clean.bat","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"","x":380,"y":640,"wires":[["a1803d15.6a8fc8"],[],[]]},{"id":"f8fb647b.038438","type":"function","z":"53b9dcde.e4cdac","name":"UpdateData","func":"msg.payload = msg.payload.replace(/(-?\\d+\\.\\d+E[-+]\\d+)/g,\nfunction(v) { return Number(v) });\n\n\npayload=msg.payload;\nvar n=payload.search(\"F\");\nmsg.n=n;\nvar sub=payload.slice(n);\n//msg.sub=sub.replace(/(\\r\\n|\\n|\\r)/gm, \"M\");\nsub=sub.split(\"\\n\");\nmsg.payload=[];\n\nvar l=(sub.length/1);\n\nfor (var i=0;i<l-1;i++)\n{\n var out={};\n var all={};\n var a=sub[i].split(\",\")\n var b=sub[i].split(\",\")\n out[\"rv\"]=a[1];\n out[\"d\"]=a[2];\n out[\"sd\"]=a[3];\n out[\"V\"]=a[4];\n out[\"W\"]=a[5];\n out[\"F\"]=a[6];\n out[\"P\"]=a[7];\n out[\"id\"]=a[0];\n out[\"timestamp\"]=Date.now();\n //out[\"Error\"]= \"\"+i;\nmsg.payload.push(out);\n \n flow.set(\"all\",msg.payload);\n \n\n}\n\nmsg.sub=sub;\n flow.set(\"all\",msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":320,"wires":[["ea9e6863.cb85e8","cb819f98.3a089"]]},{"id":"db8cef59.3e17c8","type":"change","z":"53b9dcde.e4cdac","name":"","rules":[{"t":"set","p":"ui_control","pt":"msg","to":"{\"customHeight\":18,\"tabulator\":{\"layout\":\"fitColumns\",\"movableColumns\":false,\"index\":\"id\",\"columns\":[{\"title\":\"Tagname\",\"field\":\"id\",\"formatter\":\"text\",\"headerTooltip\":\"id number act as row index\"},{\"formatterParams\":{\"outputFormat\":\"HH:mm:ss.SSS\",\"inputFormat\":\"x\",\"invalidPlaceholder\":\"(unknown)\"},\"title\":\"Timestamp\",\"field\":\"timestamp\",\"formatter\":\"datetime\",\"headerTooltip\":\"timestamp of last change\"},{\"title\":\"Value\",\"field\":\"rv\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Validation\",\"field\":\"d\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Variance\",\"field\":\"sd\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Vetistic\",\"field\":\"V\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Valuation 1\",\"field\":\"W\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Valuation 2\",\"field\":\"F\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"},{\"title\":\"Violation\",\"field\":\"P\",\"formatter\":\"text\",\"headerTooltip\":\"last cause of reboot (provided by http json request)\"}]}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":460,"wires":[["cb819f98.3a089"]]},{"id":"cb819f98.3a089","type":"ui_table","z":"53b9dcde.e4cdac","group":"7641829.33f427c","name":"","order":1,"width":18,"height":"7","columns":[{"field":"id","title":"ID","width":"","align":"right","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"timestamp","title":"Timestamp","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"RM","title":"Raw Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"rv","title":"Reconciled Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"d","title":"Revision Values","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"sd","title":"Standard Deviation","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"V","title":"Vetisticā","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":1010,"y":480,"wires":[["bed0442.37227b8"]]},{"id":"7641829.33f427c","type":"ui_group","z":"","name":"Table","tab":"3cf02e30.00f622","order":1,"disp":true,"width":"18","collapse":false},{"id":"54e8096.e2d77f8","type":"ui_group","z":"","name":"Command","tab":"3cf02e30.00f622","order":2,"disp":true,"width":"4","collapse":false},{"id":"3cf02e30.00f622","type":"ui_tab","z":"","name":"Heat Exchanger Example","icon":"dashboard","order":1,"disabled":false,"hidden":false}]