Use input msg.payload after postgres node

I'm trying to manage an alarm system using Node-RED.

Giving a function node that sends out multiple messages using node.send() method or giving a split node, I need to check if each value exists in a PostgreSQL database (SELECT statement), so after the postgres node I wish to get the input msg.payload in order to perform some actions using the payload values.

[function node] -> [postgres node] -> [switch node] -> [...]

How can I get the msg.payload generated in the output of the funciton node in the switch node?

I tried using a change node after the function node setting the payload as flow var, but it does not work. In the switch node I always see the last message sent out from the function node.

Copy the payload to a different property in the msg (e.g. msg.payloadOrig) using a change node, just before the Pg node then after, you can move it back (or just use msg.payloadOrig in the switch property instead)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.