Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combine two message payload

Tags:

node-red

I'm using node-red on one of my projects. And I'm having trouble handling two message payloads in one node. I DO NOT want to deal with them SEPARATELY, instead I want this node to combine both inputs into ONE. All the answers I found online were talked about how to deal with them in sequence, I DO NOT want that. I need to make them into ONE message payload and pass to the next node. Anyone has any insight on this?

like image 839
WhoAmIWhereAmIWhatIAmDoing Avatar asked Apr 11 '18 21:04

WhoAmIWhereAmIWhatIAmDoing


People also ask

How to merge multiple payloads into a single one?

You can use DataWeave to merge three different payloads into a single one using the service line value. Join the DZone community and get the full member experience. There are a lot of questions on StackOverflow about merging multiple payloads into a single one using a primary key.

How do I combine three payloads in dataweave?

Payload 1: Original Payload Variable (note: before transformation, set this as the payload). Payload 2: Store in flow as Variable 1. Payload 3: Store in flow as Variable 2. Now, use DataWeave to merge all three payloads into a single one using the service line value.

How do I combine two messages in a node?

Use the Join node. This can be set to combine 2 incoming messages so that the new msg.payload is an array containing the msg.payload of the input messages. Show activity on this post. Do also check out node-red-contrib-fusion which may or may not be overkill depending on your specific use case.

How to add multiple payloads to a function?

When speaking about multiple payloads, these scenarios come to my mind: When you open a function node, below the editor there is an option to add multiple outputs to your node.


1 Answers

Use the Join node.

enter image description here

This can be set to combine 2 incoming messages so that the new msg.payload is an array containing the msg.payload of the input messages.

enter image description here

like image 109
hardillb Avatar answered Oct 16 '22 20:10

hardillb