Hi community,
can you please help me with some issues regarding the loop-output? I want to send customized birthday wishes via contribute "dynamic eMail" once a day. Data are drawn from a spreadsheet as an array.
I want to run through the array, comparing each msg.payload[i].Geburtsdatum with actual date. (The strings to compare follow exactly the same format.)
I think I should put the "return msg" (or node.send?) within the loop to create an input for email-node with every new match. What would the expression be like?
Do I need to output an array containing the flow-vars or something like a "ping" for the email-node because the flows-vars are dynamically set with every loop?
Does the loop stop after mismatch and do I need an "else" with "continue" to go ahead through the list?
Thanks for your support.
const Liste = [];
var Anrede;
var Nachname;
var Mail;
for (let i = 0; i <= Liste.length; i++)
{
if (flow.get('datum_heute') === msg.payload[i].Geburtsdatum)
{
flow.set('Mail', msg.payload[i].Mail)
flow.set('Anrede', msg.payload[i].Anrede)
flow.set('Nachname', msg.payload[i].Nachname)
}
}
return msg;