how to compare 2 or 3 input by node inject or numbers
{node red v3.0.2}
how to compare 2 or 3 input by node inject or numbers
{node red v3.0.2}
Make msg.topic different for each input.
Join node, manual mode.
Use function node.
You'll need to explain yourself a little more. What nodes are you talking about?
What have ou tried? Please show your flow.
[ { "id": "ec67ef922ef1802a", "type": "function", "z": "c40dfafbcb33b182", "name": "Check Injects", "func": "context.node = context.node || 0;\ncontext.node1 = context.node1 || 0;\n\nif (msg.topic == 'a'){ \n context.node = msg.payload ;\n} else if (msg.topic = 'b'){ \n context.node1 = msg.payload;\n}\nif (context.node = context.node1) {\n return{ topic: 'd' , payload: true}\n} else { \n return { topic: 'e', payload: false }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 620, "y": 1680, "wires": [ [ "e9f7c30ff3950541" ] ] }, { "id": "e9f7c30ff3950541", "type": "debug", "z": "c40dfafbcb33b182", "name": "", "active": true, "console": "false", "complete": "payload", "x": 830, "y": 1680, "wires": [] }, { "id": "e9c03df83966101d", "type": "ui_numeric", "z": "c40dfafbcb33b182", "name": "", "label": "numeric", "tooltip": "", "group": "9acac3b2428700ea", "order": 22, "width": 0, "height": 0, "wrap": false, "passthru": true, "topic": "b", "topicType": "str", "format": "{{value}}", "min": 0, "max": 10, "step": 1, "className": "", "x": 420, "y": 1640, "wires": [ [ "ec67ef922ef1802a" ] ] }, { "id": "9ef289a10baf9a53", "type": "ui_numeric", "z": "c40dfafbcb33b182", "name": "", "label": "numeric", "tooltip": "", "group": "9acac3b2428700ea", "order": 23, "width": 0, "height": 0, "wrap": false, "passthru": true, "topic": "a", "topicType": "str", "format": "{{value}}", "min": 0, "max": 10, "step": 1, "className": "", "x": 420, "y": 1720, "wires": [ [ "ec67ef922ef1802a" ] ] }, { "id": "9acac3b2428700ea", "type": "ui_group", "name": "sys osis", "tab": "6dcd6da7b80584f0", "order": 5, "disp": true, "width": "26", "collapse": false, "className": "" }, { "id": "6dcd6da7b80584f0", "type": "ui_tab", "name": "sys osis v3", "icon": "dashboard", "disabled": false, "hidden": false } ]
In javascript you test equality with if (a == b) or if (a===b). You have if (a=b) which is an assignment not comparison.
You seem to be trying to use context variables, but wrongly. There is some documentation on context.
Try this (no context variables used)
[{"id":"e9c03df83966101d","type":"ui_numeric","z":"18302aaec057c898","name":"","label":"numeric","tooltip":"","group":"9acac3b2428700ea","order":22,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"b","topicType":"str","format":"{{value}}","min":0,"max":10,"step":1,"className":"","x":160,"y":280,"wires":[["7916735eb3d8e519"]]},{"id":"9ef289a10baf9a53","type":"ui_numeric","z":"18302aaec057c898","name":"","label":"numeric","tooltip":"","group":"9acac3b2428700ea","order":23,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"a","topicType":"str","format":"{{value}}","min":0,"max":10,"step":1,"className":"","x":160,"y":360,"wires":[["7916735eb3d8e519"]]},{"id":"c7c23c7016323515","type":"function","z":"18302aaec057c898","name":"Check Injects","func":"if (msg.payload.a == msg.payload.b) {\n return{ topic: 'd' , payload: true}\n} else { \n return { topic: 'e', payload: false }\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":320,"wires":[["2f44a25fafb43647"]]},{"id":"2f44a25fafb43647","type":"debug","z":"18302aaec057c898","name":"","active":true,"console":"false","complete":"payload","x":830,"y":320,"wires":[]},{"id":"7916735eb3d8e519","type":"join","z":"18302aaec057c898","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":410,"y":320,"wires":[["b8c2c05f765907a9","c7c23c7016323515"]]},{"id":"b8c2c05f765907a9","type":"debug","z":"18302aaec057c898","name":"debug 242","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":420,"wires":[]},{"id":"9acac3b2428700ea","type":"ui_group","name":"sys osis","tab":"6dcd6da7b80584f0","order":5,"disp":true,"width":"26","collapse":false,"className":""},{"id":"6dcd6da7b80584f0","type":"ui_tab","name":"sys osis v3","icon":"dashboard","disabled":false,"hidden":false}]
Or (without function node either)
[{"id":"e9c03df83966101d","type":"ui_numeric","z":"18302aaec057c898","name":"","label":"numeric","tooltip":"","group":"9acac3b2428700ea","order":22,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"b","topicType":"str","format":"{{value}}","min":0,"max":10,"step":1,"className":"","x":220,"y":120,"wires":[["7916735eb3d8e519"]]},{"id":"9ef289a10baf9a53","type":"ui_numeric","z":"18302aaec057c898","name":"","label":"numeric","tooltip":"","group":"9acac3b2428700ea","order":23,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"a","topicType":"str","format":"{{value}}","min":0,"max":10,"step":1,"className":"","x":220,"y":200,"wires":[["7916735eb3d8e519"]]},{"id":"7916735eb3d8e519","type":"join","z":"18302aaec057c898","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":370,"y":160,"wires":[["ac914b67444a92ef"]]},{"id":"b8c2c05f765907a9","type":"debug","z":"18302aaec057c898","name":"debug 242","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":160,"wires":[]},{"id":"7b7467bfeeed158e","type":"change","z":"18302aaec057c898","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"d","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":140,"wires":[["b8c2c05f765907a9"]]},{"id":"40e915f53c715f0a","type":"change","z":"18302aaec057c898","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"e","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":180,"wires":[["b8c2c05f765907a9"]]},{"id":"ac914b67444a92ef","type":"switch","z":"18302aaec057c898","name":"Equal?","property":"payload.a","propertyType":"msg","rules":[{"t":"eq","v":"payload.b","vt":"msg"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":520,"y":160,"wires":[["7b7467bfeeed158e"],["40e915f53c715f0a"]]},{"id":"9acac3b2428700ea","type":"ui_group","name":"sys osis","tab":"6dcd6da7b80584f0","order":5,"disp":true,"width":"26","collapse":false,"className":""},{"id":"6dcd6da7b80584f0","type":"ui_tab","name":"sys osis v3","icon":"dashboard","disabled":false,"hidden":false}]
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.