# How to send(publish) payload data sequentially?

**URL:** <https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980>\
**Category:** General\
**Created:** [22 March 2021 05:03 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980 "2021-03-22T05:03:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![OchoijuoO](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ochoijuoo/32/39105_2.png) [@OchoijuoO](https://discourse.nodered.org/u/OchoijuoO)\
**Post date:** [22 March 2021 05:03 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980/1 "2021-03-22T05:03:31Z")

</div>

Hi , I want to send Database's column data .  
/////////////////////////////////////////////////////////////////  
msg.reqList = ;//create empty array

var i = 0;  
msg.payload.rows.forEach(function(e) {  
let row = e.req\_cmd;  
msg.reqList.push(row);  
i++;  
})

msg.payload=msg.reqList;  
msg.topic=msg.mac\_addr;  
for(var j=0;j\<msg.payload.length;j++){  
node.send(msg.payload[j]);  
}  
return msg;  
///////////////////////////////////////////

After doing this code, I found debug node shows like that

["CM:142/MDNM/1","CM:846/MDNM/2","CM:691/MDNM/3"]

it's not result i want

When i subscribe 'msg.topic' ,topic have to show like that

CM:142/MDNM/1  
CM:846/MDNM/2  
CM:691/MDNM/3

How can I do like that??  
I want to publish array's element in order. Help me plz !!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 March 2021 09:14 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980/2 "2021-03-22T09:14:27Z")

</div>

I suggest reading the node-red docs page Writing Functions where it will show you how you can easily use `node.warn()` to insert debug messages into your function, which get displayed in the debug pane. That way you can work out which bit of your function is not working correctly.

Note that anything you send should be an object with, in your case I think, payload and topic properties, so you need to make sure that what you push into your `msg.reqList` array is be an object with those properties.

**[Edit]** Also, for the future please see this post for how to post flows or code so that the forum does not mess with it - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![OchoijuoO](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ochoijuoo/32/39105_2.png) [@OchoijuoO](https://discourse.nodered.org/u/OchoijuoO)\
**Post date:** [23 March 2021 08:32 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980/3 "2021-03-23T08:32:11Z")

</div>

Thanks!! I solved it

---

<div class="post-metadata">

**Author:** ![877](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/877/32/8207_2.png) [@877](https://discourse.nodered.org/u/877)\
**Post date:** [28 March 2021 16:20 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980/4 "2021-03-28T16:20:25Z")

</div>

Share how? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 May 2021 16:21 UTC](https://discourse.nodered.org/t/how-to-send-publish-payload-data-sequentially/42980/5 "2021-05-27T16:21:02Z")

</div>

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