# Filtering data and outputting to Function node with multiple outputs

**URL:** <https://discourse.nodered.org/t/filtering-data-and-outputting-to-function-node-with-multiple-outputs/81501>\
**Category:** General\
**Created:** [23 September 2023 01:12 UTC](https://discourse.nodered.org/t/filtering-data-and-outputting-to-function-node-with-multiple-outputs/81501 "2023-09-23T01:12:33Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [23 September 2023 05:09 UTC](https://discourse.nodered.org/t/filtering-data-and-outputting-to-function-node-with-multiple-outputs/81501/3 "2023-09-23T05:09:24Z")

</div>

To do it in the function after you split the payload you can do.

```auto
const output = []; 
const parts = msg.payload.split(",")
output[parts[2]-1] = {
    payload: {
        message_nr: parts[2]
        //add other items here
    }
}
return output;

```

P.S When posting code please post as text so others can copy it and do not need to retype it.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

_[View the full topic](https://discourse.nodered.org/t/filtering-data-and-outputting-to-function-node-with-multiple-outputs/81501)._
