Hi,
it maybe is a dumb question but here goes!
My function node
is reciving a message like this :
{
"_msgid":"fd517150.49f97",
"topic":"",
"payload":"Blablabla",
"Appareil":"G102_G008_L308"
}
On the other side of the function node
I want this ["Appareil" proprety split (variable number) + payload] :
Msg #1
{
"_msgid":"fd517150.49f97",
"topic":"",
"payload":"Blablabla",
"Appareil":"G102"
}
Msg #2
{
"_msgid":"fd517150.49f97",
"topic":"",
"payload":"Blablabla",
"Appareil":"G008"
}
Msg #3
{
"_msgid":"fd517150.49f97",
"topic":"",
"payload":"Blablabla",
"Appareil":"L308"
}
Msg #..... and so on
For now i've been able to split the "Appareil" proprety but I can't figure out how to make the payload follow
Inside the function node
:
var outputMsgs = [];
var words = msg.Appareil.split("_");
for (var w in words) {
outputMsgs.push({Appareil:words[w]})
}
return [outputMsgs];