Text Node Not Displaying msg

Hi,

I'm trying to display msg.payload on dashboard using text node (not text input) from the function node.

However, the msg.payload only displaying on debug tab, but not on dashboard.

[{"id":"cb5c2136.c89d5","type":"function","z":"87eeee6.729851","name":"insert-query","func":"var name = {payload: (msg.payload.savebutton.name)};\nvar lastname = {payload: (msg.payload.savebutton.lastname)};\nvar code = {payload: (msg.payload.savebutton.code)};\n//msg.payload = [name,lastname,code];\n//var name1 = {payload: (name.payload.savebutton[0])};\n//var lastname = {payload: (msg.payload[0].lastname)};\n//var code = {payload: (msg.payload[0].code)};\n//var count = {payload: (cntStr.payload.count)};\n\n//if (msg.payload[0].count === 0)\n//{\n\tinsert = {topic: \"INSERT INTO test (name,lastname,code) VALUES ('\"+ name.payload +\"','\"+ lastname.payload +\"','\"+ code.payload +\"')\"};\n    actionString = {payload: (\"Data inserted successfully!\")};\n\treturn [insert,actionString];\n/*}\n//else\n//{\n\tactionString = \"Data insertion failed!\";\n\tmsg.payload = actionString;\n    return msg;\n}*/\n\n//return msg;","outputs":2,"noerr":0,"x":850,"y":260,"wires":[["2553be2.dd98142"],["81df54f7.4125a8","f8395733.6f8d68"]]},{"id":"617d5616.2edfb8","type":"function","z":"87eeee6.729851","name":"failure-msg","func":"actionString = \"Data insertion failed!\";\nmsg.payload = actionString;\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":460,"wires":[["81df54f7.4125a8","f8395733.6f8d68"]]},{"id":"81df54f7.4125a8","type":"mui_text","z":"87eeee6.729851","group":"862f3f87.367da","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":1030,"y":360,"wires":[]},{"id":"862f3f87.367da","type":"mui_group","z":"","name":"Input Test - Multiple Users","tab":"29df8a3d.2c7ba6","order":1,"disp":true,"width":"6","collapse":false},{"id":"29df8a3d.2c7ba6","type":"mui_tab","z":"","name":"I4Inari","icon":"dashboard","order":1}]

Thanks for helping.

I don't know what the mui_text node is but it does not seem to be one of the standard dashboard nodes. Have you installed a different set of dashboard nodes? If so then I suggest that you uninstall that (don't just remove it from your flows, actually uninstall it) and install the node red standard dashboard nodes node-red-dashboard.

FYI: node-red-contrib-mdashboard - a fork of the node-red-dashboard

Make sure you are only install one of the two dashboards

Your code snippet
(1) has no debug node,
(2) the function nodes are not triggerable.

Please providde a code snippet that will start with an inject node and display the issue so someone can test it.

mui nodes are the nodes from mdashboard (multi-user dashboard). I'm using mdashboard instead of standard dashboard as I need multiple users to use the web application.

What will happen if I'm using standard dashboard for my web application? If two users have the same dashboard open and one user types into a text input, the other user will not get the text update. This works well when a typical web form like behavior is needed- multiple users can use the same dashboard url as a form to submit data back to the flow.

The following is the flow. I'm using input nodes to get the data.

[{"id":"b107d7d0.8bcf98","type":"function","z":"87eeee6.729851","name":"select-query","func":"//var name = {payload: (msg.payload.name)};\n//msg.payload = name;\nvar select = {topic: \"SELECT COUNT(*) AS count FROM test WHERE name='\" + msg.payload.name + \"'\"};\n\nreturn select;","outputs":1,"noerr":0,"x":671,"y":176,"wires":[["23d2748d.b5669c"]]},{"id":"cb5c2136.c89d5","type":"function","z":"87eeee6.729851","name":"insert-query","func":"var name = {payload: (msg.payload.savebutton.name)};\nvar lastname = {payload: (msg.payload.savebutton.lastname)};\nvar code = {payload: (msg.payload.savebutton.code)};\n//msg.payload = [name,lastname,code];\n//var name1 = {payload: (name.payload.savebutton[0])};\n//var lastname = {payload: (msg.payload[0].lastname)};\n//var code = {payload: (msg.payload[0].code)};\n//var count = {payload: (cntStr.payload.count)};\n\n//if (msg.payload[0].count === 0)\n//{\n\tinsert = {topic: \"INSERT INTO test (name,lastname,code) VALUES ('\"+ name.payload +\"','\"+ lastname.payload +\"','\"+ code.payload +\"')\"};\n    msg.payload = \"Data inserted successfully!\";\n\treturn [insert,msg];\n/*}\n//else\n//{\n\tactionString = \"Data insertion failed!\";\n\tmsg.payload = actionString;\n    return msg;\n}*/\n\n//return msg;","outputs":2,"noerr":0,"x":871,"y":276,"wires":[["2553be2.dd98142"],["a00de898.21c298"]]},{"id":"bd18f1d0.01967","type":"switch","z":"87eeee6.729851","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"savebutton","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":491,"y":176,"wires":[["b107d7d0.8bcf98","4346a1b0.99183"]]},{"id":"7e1ee6ef.c4ec08","type":"mui_button","z":"87eeee6.729851","name":"save-button","group":"862f3f87.367da","order":5,"width":0,"height":0,"passthru":false,"label":"Save","color":"","bgcolor":"","icon":"","payload":"{}","payloadType":"global","topic":"savebutton","x":151,"y":276,"wires":[["4f6f5725.bf21d8"]]},{"id":"17abf0bb.ba670f","type":"mui_dropdown","z":"87eeee6.729851","name":"lastname","label":"","place":"Select Last Name","group":"862f3f87.367da","order":3,"width":0,"height":0,"passthru":false,"options":[{"label":"Rishan","value":1,"type":"num"},{"label":"Login","value":2,"type":"num"}],"payload":"","topic":"lastname","x":141,"y":156,"wires":[["4f6f5725.bf21d8"]]},{"id":"a8d9a9b0.81f358","type":"mui_text_input","z":"87eeee6.729851","name":"code","label":"Code","group":"862f3f87.367da","order":4,"width":0,"height":0,"passthru":false,"mode":"text","delay":300,"topic":"code","x":131,"y":216,"wires":[["4f6f5725.bf21d8"]]},{"id":"4f6f5725.bf21d8","type":"join","z":"87eeee6.729851","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":331,"y":176,"wires":[["bd18f1d0.01967"]]},{"id":"ea75af48.2081b","type":"switch","z":"87eeee6.729851","name":"","property":"payload[0].count","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":691,"y":376,"wires":[["4346a1b0.99183"],["617d5616.2edfb8"]]},{"id":"617d5616.2edfb8","type":"function","z":"87eeee6.729851","name":"failure-msg","func":"msg.payload = \"Data insertion failed!\";\nreturn msg;","outputs":1,"noerr":0,"x":871,"y":476,"wires":[["a00de898.21c298"]]},{"id":"4346a1b0.99183","type":"join","z":"87eeee6.729851","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":691,"y":276,"wires":[["cb5c2136.c89d5"]]},{"id":"23d2748d.b5669c","type":"link out","z":"87eeee6.729851","name":"select-output","links":["28a57ab7.f38e96"],"x":796,"y":176,"wires":[]},{"id":"7dcb6f8e.54a73","type":"link in","z":"87eeee6.729851","name":"switch-input","links":["f51faf38.14fbf"],"x":576,"y":376,"wires":[["ea75af48.2081b"]]},{"id":"2553be2.dd98142","type":"link out","z":"87eeee6.729851","name":"insert-output","links":["d30ab41a.fdd448"],"x":1016,"y":176,"wires":[]},{"id":"853c9662.1fd928","type":"mui_text_input","z":"87eeee6.729851","name":"name","label":"Name","group":"862f3f87.367da","order":1,"width":0,"height":0,"passthru":false,"mode":"text","delay":300,"topic":"name","x":130,"y":100,"wires":[["4f6f5725.bf21d8"]]},{"id":"a00de898.21c298","type":"debug","z":"87eeee6.729851","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":1070,"y":380,"wires":[]},{"id":"862f3f87.367da","type":"mui_group","z":"","name":"Input Test - Multiple Users","tab":"29df8a3d.2c7ba6","order":1,"disp":true,"width":"6","collapse":false},{"id":"29df8a3d.2c7ba6","type":"mui_tab","z":"","name":"I4Inari (Test)","icon":"dashboard","order":3}]

I notice you have link nodes, but they are not connected. Did you do this for a reason or do you not know you have to open a link then click the check mark next to the link you want to attach to?

Also, what are you trying to do?

@rishanaziz where in your flow are you passing a message to a text node? That screenshot doesn't show it anywhere.

1 Like

Actually, I'm going to put text node at the place where now debug node is. I want to make text node to display the massage.

As I see it you have a couple issues.

  1. the switch input node throws an error because it is looking for msg.payload[0].count which does not exist anywhere else in yout flow
  2. If you open the dashboard in two different browser (A and B) and enter name and code in one, then switch to the other (B) and enter name and select last name, then switch back to the first (A) and press SAVE, you get the name and last name from (B) and the code from (A)

I experienced the 1st issue because the msg.payload.count[0] is coming up from COUNT() SQL statement from the function. I just checked the 2nd issue that you had found. What can be done to fix this?

I'm just not sure if this is something that can be "fixed". Both the node-red server and the dashboard are (by design) single tenant client/server applications. If two clients (browsers) are editing different properties (name, lastname, code) of the same object (msg), then I would expect there could be collisions...

If you really need different sessions for individual user experiences, then you may need to use other tools to build a multi-user application, or create your own UI with something like node-red-contrib-ui-builder -- just keep in mind that all the flows in the back-end node-red server are still single-tenant, and single-threaded.

1 Like

I know this is old but I get the same issue.

Using mdashboard the text node displays if putting in values directly into Label and Value format, but if using
{{msg.topic}} and {{msg.payload}} to update from an inject node it does not update, its just blank.

I tested on two different node red installations, and same issue.

Mdashboard is not the official project dashboard. Please raise the issue direct with the author. Or uninstall it and retry with node-red-dashboard

Problem with the dashboard is if two people are viewing and you select a drop down it changes for both people. However I figured out that with mdashboard you just have to grab the socketid and send that to the node with the normal message.