i'm a nodered beginner and i don't speak english very well but i will try to make my self understood. The purpose of my flow should be to enter Id, Name and Surname of a worker on a telegram bot and record it in db in case the id does not already exist in the db itself. To understand if it exists I used a select and if this select is nothing I proceed with an insert. The problem is that from the table I see that through the insert I enter only null values and also despite entering the same id several times does not tell me that it is already present. Can anyone help me? below I entered the flow.
[{"id":"b9714c6481595ac3","type":"tab","label":"Flow 2","disabled":false,"info":"","env":[]},{"id":"2908f8ba29fe8611","type":"chatbot-message","z":"b9714c6481595ac3","name":"","message":[{"message":"Sign in"}],"language":"none","x":510,"y":380,"wires":[["f36cc6a2c69534a0"]]},{"id":"f36cc6a2c69534a0","type":"chatbot-message","z":"b9714c6481595ac3","name":"","message":[{"message":"Insert your name"}],"language":"none","x":650,"y":380,"wires":[["8ecc9d2cb6781465"]]},{"id":"8ecc9d2cb6781465","type":"chatbot-telegram-send","z":"b9714c6481595ac3","bot":"9672c375.5e41","botProduction":"","track":true,"passThrough":false,"errorOutput":false,"outputs":1,"x":850,"y":380,"wires":[["fa766618e224c4fa"]]},{"id":"fa766618e224c4fa","type":"chatbot-parse","z":"b9714c6481595ac3","name":"","parseType":"string","parseVariable":"nome","x":1100,"y":380,"wires":[["5647bc26e07a3ee8"],[]]},{"id":"5647bc26e07a3ee8","type":"chatbot-message","z":"b9714c6481595ac3","name":"","message":[{"message":"Insert your surname"}],"language":"none","x":650,"y":460,"wires":[["d76185d79b8bef02"]]},{"id":"d76185d79b8bef02","type":"chatbot-telegram-send","z":"b9714c6481595ac3","bot":"9672c375.5e41","botProduction":"","track":true,"passThrough":false,"errorOutput":false,"outputs":1,"x":850,"y":460,"wires":[["c6b46ed6da4e35df"]]},{"id":"c6b46ed6da4e35df","type":"chatbot-parse","z":"b9714c6481595ac3","name":"","parseType":"string","parseVariable":"cognome","x":1100,"y":460,"wires":[["92a87b558847f5de"],[]]},{"id":"92a87b558847f5de","type":"chatbot-message","z":"b9714c6481595ac3","name":"","message":[{"message":"Insert ID"}],"language":"none","x":650,"y":540,"wires":[["fbc28402837d7eac"]]},{"id":"fbc28402837d7eac","type":"chatbot-telegram-send","z":"b9714c6481595ac3","bot":"9672c375.5e41","botProduction":"","track":true,"passThrough":false,"errorOutput":false,"outputs":1,"x":850,"y":540,"wires":[["a4396041418b2032"]]},{"id":"a4396041418b2032","type":"chatbot-parse","z":"b9714c6481595ac3","name":"","parseType":"string","parseVariable":"ID","x":1100,"y":540,"wires":[["c38592c881cbcb4d"],[]]},{"id":"c38592c881cbcb4d","type":"function","z":"b9714c6481595ac3","name":"","func":"var chat = msg.chat();\nvar nome = chat.get('nome');\nvar cognome = chat.get('cognome');\nvar ID = chat.get('ID');\nmsg.topic = \"INSERT INTO operatore VALUES (?,?,?)\";\nmsg.payload = {\"IDoperatore\":ID,\"Nome\":nome, \"Cognome\":cognome};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1280,"y":540,"wires":[["6ead44f661d8116a","ef35fbb6bd8e0e1d","2829f2f12633470f","d2f73b749f74a46d"]]},{"id":"6ead44f661d8116a","type":"debug","z":"b9714c6481595ac3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1530,"y":520,"wires":[]},{"id":"d50f04cec29391bb","type":"ui_table","z":"b9714c6481595ac3","group":"","name":"Tabella Operatori","order":1,"width":"6","height":"5","columns":[{"field":"IDoperatore","title":"IDoperatore","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Cognome","title":"Cognome","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}},{"field":"Nome","title":"Nome","width":"","align":"left","formatter":"plaintext","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":1410,"y":260,"wires":[[]]},{"id":"34a43c2c31e9e28c","type":"ui_button","z":"b9714c6481595ac3","name":"","group":"","order":0,"width":0,"height":0,"passthru":false,"label":"","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"","topicType":"str","x":750,"y":260,"wires":[["4e60edae1c8cf808"]]},{"id":"4e60edae1c8cf808","type":"change","z":"b9714c6481595ac3","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"SELECT * FROM operatore;","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":260,"wires":[["e0bbedda447d0dab"]]},{"id":"df027ebe6df7a7f1","type":"http in","z":"b9714c6481595ac3","name":"","url":"/reg/wo","method":"get","upload":false,"swaggerDoc":"","x":270,"y":800,"wires":[["8bcd5d3115cb8410","847e38b99d653106"]]},{"id":"f907b452ff9998e5","type":"http response","z":"b9714c6481595ac3","name":"","statusCode":"","headers":{},"x":1910,"y":920,"wires":[]},{"id":"67695cb26baeabe9","type":"change","z":"b9714c6481595ac3","name":"INSERT","rules":[{"t":"set","p":"params","pt":"msg","to":"[payload.nome, payload.cognome, payload.ID\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":820,"wires":[["faf1db7123e0b317","0050dd78e4ebe77c"]]},{"id":"7ca077be463b610e","type":"switch","z":"b9714c6481595ac3","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"null"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1530,"y":760,"wires":[["35efb9facbee9d72"],["c878381a9a79f3c1"]]},{"id":"35efb9facbee9d72","type":"change","z":"b9714c6481595ac3","name":"","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"200","tot":"num"},{"t":"set","p":"payload","pt":"msg","to":"Operatore creato","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1700,"y":700,"wires":[["f907b452ff9998e5"]]},{"id":"8bcd5d3115cb8410","type":"change","z":"b9714c6481595ac3","name":"SELECT","rules":[{"t":"set","p":"datiOperatore","pt":"msg","to":"{\t\"IDoperatore\":payload.ID,\t\"Nome\":payload.nome,\t\"Cognome\":payload.cognome\t}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"SELECT * FROM operatore WHERE IDoperatore = ?","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"[\t$string(datiOperatore.IDoperatore)\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":860,"wires":[["cdc8c1e47449b158","e8f5a204312ea8e0","0d47e16a6b7e1db8"]]},{"id":"c542d16d2a232a72","type":"switch","z":"b9714c6481595ac3","name":"","property":"payload[0]","propertyType":"msg","rules":[{"t":"null"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":950,"y":860,"wires":[["67695cb26baeabe9","e7d81d5f3ef34886"],["bc6fe9053f3a87ab","fc05092495de84fb"]]},{"id":"bc6fe9053f3a87ab","type":"change","z":"b9714c6481595ac3","name":"","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"409","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Operatore esistente","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1180,"y":920,"wires":[["f907b452ff9998e5"]]},{"id":"fc05092495de84fb","type":"debug","z":"b9714c6481595ac3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1150,"y":980,"wires":[]},{"id":"d2f73b749f74a46d","type":"http request","z":"b9714c6481595ac3","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"https://\"knbjbk\".azurewebsites.net/reg/wo","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":1530,"y":480,"wires":[["16b15b28548d3d65"]]},{"id":"16b15b28548d3d65","type":"chatbot-telegram-send","z":"b9714c6481595ac3","bot":"9672c375.5e41","botProduction":"","track":false,"passThrough":false,"errorOutput":false,"outputs":0,"x":1810,"y":520,"wires":[]},{"id":"ef35fbb6bd8e0e1d","type":"chatbot-waiting","z":"b9714c6481595ac3","waitingType":"typing","x":1520,"y":560,"wires":[["16b15b28548d3d65"]]},{"id":"b39e4686fe172778","type":"sqlite","z":"b9714c6481595ac3","mydb":"","sqlquery":"msg.topic","sql":"","name":"DB worker","x":1010,"y":160,"wires":[[]]},{"id":"27bbb55d8240f1fd","type":"inject","z":"b9714c6481595ac3","name":"CREATE","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"CREATE TABLE operatore (Nome Varchar, Cognome Varchar, IDoperatore Varchar)","payload":"","payloadType":"date","x":840,"y":140,"wires":[["b39e4686fe172778"]]},{"id":"2382febe5a9f1778","type":"inject","z":"b9714c6481595ac3","name":"DROP","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"DROP TABLE operatore","payload":"","payloadType":"date","x":850,"y":180,"wires":[["b39e4686fe172778"]]},{"id":"2829f2f12633470f","type":"chatbot-message","z":"b9714c6481595ac3","name":"","message":[{"message":"Welcome Worker: {{nome}} {{cognome}} \n\n"}],"language":"none","x":1510,"y":600,"wires":[["16b15b28548d3d65"]]},{"id":"e0bbedda447d0dab","type":"sqlite","z":"b9714c6481595ac3","mydb":"","sqlquery":"msg.topic","sql":"","name":"DB worker","x":1170,"y":260,"wires":[["d50f04cec29391bb"]]},{"id":"cdc8c1e47449b158","type":"sqlite","z":"b9714c6481595ac3","mydb":"","sqlquery":"msg.topic","sql":"SELECT * FROM operatore WHERE IDoperatore = ?","name":"DB worker","x":750,"y":860,"wires":[["c542d16d2a232a72","e33d39e6363b396c","d1478f0c8acec50b"]]},{"id":"faf1db7123e0b317","type":"sqlite","z":"b9714c6481595ac3","mydb":"","sqlquery":"prepared","sql":"INSERT INTO operatore (IDoperatore, Nome, Cognome) VALUES (?,?,?);","name":"DB worker","x":1350,"y":760,"wires":[["7ca077be463b610e"]]},{"id":"1bb4a5f994cc6438","type":"chatbot-rules","z":"b9714c6481595ac3","name":"/reg","rules":[{"type":"commandStartsWith","command":"/reg"}],"outputs":1,"x":330,"y":380,"wires":[["2908f8ba29fe8611"]]},{"id":"e8f5a204312ea8e0","type":"debug","z":"b9714c6481595ac3","name":"debug 52","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":720,"y":740,"wires":[]},{"id":"0050dd78e4ebe77c","type":"debug","z":"b9714c6481595ac3","name":"debug 53","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1340,"y":680,"wires":[]},{"id":"e33d39e6363b396c","type":"debug","z":"b9714c6481595ac3","name":"debug 54","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":920,"y":740,"wires":[]},{"id":"e7d81d5f3ef34886","type":"debug","z":"b9714c6481595ac3","name":"debug 56","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1160,"y":780,"wires":[]},{"id":"847e38b99d653106","type":"debug","z":"b9714c6481595ac3","name":"debug 57","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":740,"wires":[]},{"id":"d1478f0c8acec50b","type":"debug","z":"b9714c6481595ac3","name":"debug 58","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":940,"y":780,"wires":[]},{"id":"0d47e16a6b7e1db8","type":"debug","z":"b9714c6481595ac3","name":"debug 59","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":780,"wires":[]},{"id":"c878381a9a79f3c1","type":"change","z":"b9714c6481595ac3","name":"","rules":[{"t":"set","p":"statusCode","pt":"msg","to":"500","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1700,"y":800,"wires":[["f907b452ff9998e5"]]},{"id":"b61e446fe07af892","type":"chatbot-telegram-receive","z":"b9714c6481595ac3","bot":"","botProduction":"","x":90,"y":580,"wires":[["1bb4a5f994cc6438"]]},{"id":"9672c375.5e41","type":"chatbot-telegram-node","botname":"","usernames":"","polling":"1000","store":"","log":"","debug":false,"skipMediaFiles":false,"webHook":"","connectMode":"polling","storeMessages":false,"enableMissionControl":false,"inspectMessages":false,"chatbotId":""}]