Reputation: 1
at the moment I've a little problem with one function. I'll create a function as switch. But I can't see that I route the msg block to the right output.
payloadJSON = JSON.parse(msg.payload, (key, value)=> {
if(key == "changeType") {
if (value === "create" ) {
node.error('In: ' + value);
return [ msg, null, null, null ];
}else if(value === "update" ) {
node.error('In: ' + value);
return [ null, msg, null, null ];
}else if(value === "delete" ) {
node.error('In: ' + value);
return [ null, null, msg, null ];
}else{
node.error('In: ' + "otherwise");
return [ null, null, null, msg ];
}
}
});
Yes I configure 4 Outputs in the function
I can see the node.error message in the log, but I can't see any Output from the attached Debug Output .
Upvotes: 0
Views: 3248
Reputation: 10117
Your return statements are inside the function you've passed to the JSON.parse
call - so they are not returning anything to Node-RED.
You need to use node.send([msg,null ... ]);
in place of those return statements.
Upvotes: 3