hi !
i want to connect between node red and MSSM (sql ) but i didnt know how to do could you help me please ?
Do you have a DB Table Schema to work to? If not, that is the first step, working out what table(s) you need.
As your three values are from separate nodes, you need to join them into 1 msg
so that you can access all 3 values at one time. This can be by storing the values in context OR using the join node.
Here is a demo using the join node that you can use to make yours work...
The flow (use CTRL+I
to import)
[{"id":"1ab0eeb7b9fb731f","type":"inject","z":"79d198b88749c016","name":"temp","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temp","payload":"(\t $minimum := 30;\t $maximum := 60;\t $round(($random() * ($maximum-$minimum)) + $minimum, 1)\t)","payloadType":"jsonata","x":1106,"y":1024,"wires":[["ed94f94935267d46"]]},{"id":"ed94f94935267d46","type":"join","z":"79d198b88749c016","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1316,"y":1072,"wires":[["911a2e4db4d75980","cb246ba16a7bdc9c"]]},{"id":"72aca28e646ee888","type":"inject","z":"79d198b88749c016","name":"speed RPM","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"rpm","payload":"(\t $minimum := 90;\t $maximum := 110;\t $round(($random() * ($maximum-$minimum)) + $minimum, 0)\t)","payloadType":"jsonata","x":1124,"y":1072,"wires":[["ed94f94935267d46"]]},{"id":"997a43fd5b879854","type":"inject","z":"79d198b88749c016","name":"pressure","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"pres_bar","payload":"(\t $minimum := 4;\t $maximum := 6;\t $round(($random() * ($maximum-$minimum)) + $minimum, 2)\t)","payloadType":"jsonata","x":1118,"y":1120,"wires":[["ed94f94935267d46"]]},{"id":"911a2e4db4d75980","type":"debug","z":"79d198b88749c016","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1354,"y":1120,"wires":[]},{"id":"cb246ba16a7bdc9c","type":"MSSQL","z":"79d198b88749c016","mssqlCN":"f4edb6ec.2c29f8","name":"","outField":"payload","returnType":0,"throwErrors":1,"query":"INSERT INTO myTable (col1, col2, col3)\r\nVALUES (@v1, @v2, @v3)\r\n","modeOpt":"queryMode","modeOptType":"query","queryOpt":"payload","queryOptType":"editor","paramsOpt":"","paramsOptType":"editor","rows":"rows","rowsType":"msg","params":[{"output":false,"name":"v1","type":"Float","valueType":"msg","value":"payload.temp","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}},{"output":false,"name":"v2","type":"Int","valueType":"msg","value":"payload.rpm","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}},{"output":false,"name":"v3","type":"Float","valueType":"msg","value":"payload.pres_bar","options":{"nullable":true,"primary":false,"identity":false,"readOnly":false}}],"x":1504,"y":1072,"wires":[[]]},{"id":"f4edb6ec.2c29f8","type":"MSSQL-CN","tdsVersion":"7_4","name":"","server":"192.168.1.38","port":"1433","encyption":true,"trustServerCertificate":true,"database":"testdb","useUTC":true,"connectTimeout":"15000","requestTimeout":"15000","cancelTimeout":"5000","pool":"5","parseJSON":false,"enableArithAbort":true}]
we need to connect it to " plc s7 " ( machine siemens ) and that doesn't work
You title says "connecting node red with sql"
Your post says
Where does this mention Siemens S7?
Please state clearly what the problem is?
Are you able to read values from the PLC? Use debug
nodes to understand this.
sorry , i fixed it
actually i didn't know where is the exact problem i wanted to connect them but there's nothing working