Batch node use case example

Hi ,

I am a newbie to node-red and I am trying to understand the usages of each node . I couldn't find any examples around batch node to understand the use case where the node fits in . I read through the brief definition and the 3 modes of operation which technically able to understand but on a realtime use case I am not able to find a story.

When I tried using the batch node with debug i could see the output from batch node but I was in an assumption that each batch is having specific unique id. But the response I am observing is all having same id (message id).

Flow

Inject node --> Function node(code give below) --> batch node(sequence by number of message ,set as 2) --> Debug node

Function node code

for(var i=0; i<4 ;i++){
node.send({payload:i});
}
return msg;

Could you please share any examples or link directing to the usage of a batch node.

Regards
Arun

When debugging, use the 'complete msg object' to see the full message.

The batch node is used in conjunction with the join node. Each message in the batch gets a msg.parts with an index and a count number. The join node can use the index and the count to create a (new) merged object, new string, array etc.

Thanks @bakman2 for the quick response.

Let me give a try in conjunction with the join node.

Regards
Arun