hi everyone.
Once more as i have just started using node red and i am not a programmer, i have some questions.
I have the flow below
[{"id":"42edc0b9.7ba91","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"19767207.06a18e","type":"mysql","z":"42edc0b9.7ba91","mydb":"e717861e.a17788","name":"MYSQL","x":1108,"y":167,"wires":[["7693b48a.4d133c"]]},{"id":"b66a3eab.b6907","type":"template","z":"42edc0b9.7ba91","name":"Format data","field":"topic","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"INSERT INTO Devices (id,pulse,date) VALUES (id,pulse,date)","output":"str","x":845,"y":169,"wires":[["19767207.06a18e","7693b48a.4d133c"]]},{"id":"b7e62e32.3c844","type":"comment","z":"42edc0b9.7ba91","name":"Flow to insert data into the database","info":"","x":880,"y":120,"wires":[]},{"id":"8b512bd8.e229c8","type":"delay","z":"42edc0b9.7ba91","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":576,"y":125,"wires":[["b66a3eab.b6907","7693b48a.4d133c"]]},{"id":"7693b48a.4d133c","type":"debug","z":"42edc0b9.7ba91","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1069,"y":303,"wires":[]},{"id":"cc1e9263.ecc9","type":"function","z":"42edc0b9.7ba91","name":"Parse data","func":"let parsed = {} \nlet p = msg.payload\nparsed.parts = p.split(\"\");\n//parsed.data = p;\n//parsed.datalength = parseInt(parsed.parts[1],16);\nparsed.date = parseInt(parsed.parts[0] + parsed.parts[1] + parsed.parts[2] + parsed.parts[3] + parsed.parts[4] + parsed.parts[5]+ parsed.parts[6] + parsed.parts[7],10);\nparsed.time = parseInt(parsed.parts[8] + parsed.parts[9] + parsed.parts[10] + parsed.parts[11] + parsed.parts[12] + parsed.parts[13],10);\nparsed.type = parseInt(parsed.parts[14] + parsed.parts[15],10);\nparsed.id = parseInt(parsed.parts[16] + parsed.parts[17] + parsed.parts[18] + parsed.parts[19] + parsed.parts[20] + parsed.parts[21],16);\nparsed.BatStatus = parseInt(parsed.parts[22] + parsed.parts[23],16);\nparsed.pulse = parseInt(parsed.parts[24] + parsed.parts[25] + parsed.parts[26] + parsed.parts[27] + parsed.parts[28] + parsed.parts[29],16);\nparsed.Sigstatus = parseInt(parsed.parts[30] + parsed.parts[31],16);\nparsed.CheckCode = parseInt(parsed.parts[32] + parsed.parts[33] + parsed.parts[34] + parsed.parts[35],16);\n\n\nmsg.payload = parsed; \n//.nodegroup = parsed.id;\n//msg.payload.parsed.Date\nreturn msg;\n","outputs":1,"noerr":0,"x":399,"y":171,"wires":[["8b512bd8.e229c8"]]},{"id":"f0cfae94.94da6","type":"file in","z":"42edc0b9.7ba91","name":"msg.filename","filename":"","format":"lines","chunk":false,"sendError":false,"encoding":"utf8","x":288,"y":357,"wires":[["cc1e9263.ecc9"]]},{"id":"956b1953.df0cc8","type":"change","z":"42edc0b9.7ba91","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":137,"y":290,"wires":[["f0cfae94.94da6"]]},{"id":"800c4dc.40830b","type":"watch","z":"42edc0b9.7ba91","name":"","files":"/home/emonadmin/testdb/","recursive":"","x":115,"y":196,"wires":[["956b1953.df0cc8"]]},{"id":"e717861e.a17788","type":"MySQLdatabase","z":"","host":"127.0.0.1","port":"3306","db":"AMRData","tz":""}]
I have the above flow working and post data to emoncms.
Now what i want to do is to post specific data to an mysql database.
How can i send specific data from the array and insert it to sql at the corresponding tables?
Here is the data i get from the file i try to read.
Thank you in advance