Hi. A simple issue that eludes my meager knowledge: User inputs a number (egg count). The input is timestamped and is recalled for display in a chart (Show how many eggs for the last 10 days, per day). This works well, as per below, with the caveat that if I input the count 2 or 3 times in a day, the chart won't sum it up. It will display it as each entry. Can someone assist with the mod needed in the function to sum up all results from the same day ? (e.g. in the morning, I input 9. In the afternoon, I input 5. The chart should show 14 for today. Not 9, then 4, with the same date).
[{"id":"5d4be9cd3f2fb5a7","type":"group","z":"1be556fa6eb0cb07","name":"Eggs graphics","style":{"label":true},"nodes":["24c58de4247bee58","d8b58e7bb50780ea","3947e94b6414de44","600fa4ed171d49f1","6ec0233fa9f2c446"],"x":974,"y":39,"w":822,"h":82},{"id":"24c58de4247bee58","type":"function","z":"1be556fa6eb0cb07","g":"5d4be9cd3f2fb5a7","name":"Fetch Eggs","func":"msg.topic=\"SELECT * FROM `eggsrecord` WHERE date between date_sub(now(),INTERVAL 1 WEEK) and now() ORDER BY date\";\nmsg.payload=[msg.payload];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1270,"y":80,"wires":[["6ec0233fa9f2c446"]]},{"id":"d8b58e7bb50780ea","type":"link out","z":"1be556fa6eb0cb07","g":"5d4be9cd3f2fb5a7","name":"EggCount","links":["d9f75986.4bd638","254a1bc5.a62c34"],"x":1755,"y":80,"wires":[]},{"id":"3947e94b6414de44","type":"inject","z":"1be556fa6eb0cb07","g":"5d4be9cd3f2fb5a7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"900","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":1090,"y":80,"wires":[["24c58de4247bee58"]]},{"id":"600fa4ed171d49f1","type":"function","z":"1be556fa6eb0cb07","g":"5d4be9cd3f2fb5a7","name":"","func":"var data = [];\nvar date = [];\nmsg.payload.forEach(function(value) {\n data.push(value['EggQty']);\n date.push(value['Date']);\n});\n\nmsg.payload = [{\n series: \"\",\n data: [data],\n labels: date\n}];\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1580,"y":80,"wires":[["d8b58e7bb50780ea","9a0a1cc9145c9920"]]},{"id":"6ec0233fa9f2c446","type":"mysql","z":"1be556fa6eb0cb07","g":"5d4be9cd3f2fb5a7","mydb":"dc5d34f2.4b5a38","name":"","x":1430,"y":80,"wires":[["600fa4ed171d49f1"]]},{"id":"dc5d34f2.4b5a38","type":"MySQLdatabase","name":"","host":"192.168.2.10","port":"3306","db":"eggs","tz":"UTC","charset":"UTF8"}]
Any insight is appreciated.