# Seperating an array into individual messages

**URL:** <https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710>\
**Category:** General\
**Created:** [4 June 2021 21:09 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710 "2021-06-04T21:09:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudomac](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@sudomac](https://discourse.nodered.org/u/sudomac)\
**Post date:** [4 June 2021 21:09 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710/1 "2021-06-04T21:09:14Z")

</div>

I am using a flex Getter from "node-red-contrib-modbus". The message it returns is an 8 bit array that looks like this, [true,false,false,false,false,false,false,false]. I am only interested in the first value. How can I separate and ignore the other values?  
Ex. When the modbus address is true, It returns: [true,false,false,false,false,false,false,false]  
When the modbus address is false, it returns: [false,false,false,false,false,false,false,false]

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [4 June 2021 22:15 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710/2 "2021-06-04T22:15:34Z")

</div>

Use a change node that sets msg.payload as follows:

msg.payload[0]

---

<div class="post-metadata">

**Author:** ![sudomac](https://avatars.discourse-cdn.com/v4/letter/s/e95f7d/32.png) [@sudomac](https://discourse.nodered.org/u/sudomac)\
**Post date:** [6 June 2021 12:04 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710/3 "2021-06-06T12:04:08Z")

</div>

Thank you for the reply. I will give it a try. I also found an array splitter node that does "more than likely" the same thing. I do prefer to use function nodes though,

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [6 June 2021 13:41 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710/4 "2021-06-06T13:41:25Z")

</div>

The change node will do the trick, no need for a function node.

---

<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:** [5 August 2021 13:41 UTC](https://discourse.nodered.org/t/seperating-an-array-into-individual-messages/46710/5 "2021-08-05T13:41:38Z")

</div>

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