Hello,
i would like to read a value from a SQL database and use the value in my flow. its my first attempt to do that and i have a Problem, Maybe based on msg structure misunterdstanding.
Here is a Picture of the part of the Flow:
Here the part of the flow:
[{"id":"17fd4fda.6273f","type":"function","z":"af61c022.bc96e","name":"SQL Read","func":"var sql1 = \"SELECT Getriebe_Betriebsstunden \";\nvar sql2 = \"FROM aktuelle_alex_daten \";\nvar sql3 = \"WHERE Name_Pruefstand =\";\nvar sql4 = \"'\"+\"W03\"+\"'\"\n\n\n\n\nmsg.topic = sql1 + sql2 + sql3 + sql4;\nreturn msg;","outputs":1,"noerr":0,"x":1030,"y":1020,"wires":[["6853a388.430adc"]]},{"id":"e4debac5.f4a8e8","type":"function","z":"af61c022.bc96e","name":"Payload Weitergabe","func":"msg.topic = \"ATESTEO/Wolfsburg/W03\";\nmsg.payload.Zeitausgabe = msg.payload.Getriebe_Betriebsstunden;\nreturn msg;","outputs":1,"noerr":0,"x":1510,"y":1020,"wires":[[]]},{"id":"6853a388.430adc","type":"mysql","z":"af61c022.bc96e","name":"","x":1290,"y":1020,"wires":[["e4debac5.f4a8e8"]]}]
i changed the mysql node, because i dont want to post the real one.
Here is the output of the SQL Read function node:
Here is the output of the mysql node:
And here is the output of the last Payload Weitergabe node:
I have problems to get the value of Getriebe_Betriebsstunden in a variable.
I tried a Change node and some other things but Nothing works...
Maybe someone has a solution for this ?
Chorum