Hi
I am stuck with the flow that shown below, its read from DB and then does checking process by using If statement, then displays the output. The problem is that it's duplicated the message payload each time injected node that will cause me a duplicate when will insert the results to DB again... Please I want to know why that happened.
The flow is
The code in the second function (checking ) is
var i;
var in_mac;
let person;
let newmsg;
msg.payload.forEach(item => {
if (item.in_mac === "f123"){
person = "tom";
} else if (item.in_mac === "abc"){
person = "james";
}
newmsg = {employee: person, Date:new Date().toLocaleDateString(), Time: new Date().toLocaleTimeString()};
node.send({payload: newmsg});
});
node.done();
return;
The results is