# Help to filter data

**URL:** <https://discourse.nodered.org/t/help-to-filter-data/41096>\
**Category:** General\
**Created:** [16 February 2021 15:26 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096 "2021-02-16T15:26:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrleinonen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hrleinonen/32/37329_2.png) [@hrleinonen](https://discourse.nodered.org/u/hrleinonen)\
**Post date:** [16 February 2021 15:26 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096/1 "2021-02-16T15:26:07Z")

</div>

Hi,

I try to create function which filters data out based on values.

 ![Screenshot 2021-02-16 at 17.22.43](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/5/8507c94cf459748f734110fdaa65a27b419dd992.png)

I only need values where visible is true. I've been banging my head against wall now 2 days for this.  
If there is better way to do this than function, it would be nice to hear it.

Thank you very much, for help.

Br,

Ville

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [16 February 2021 15:36 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096/2 "2021-02-16T15:36:21Z")

</div>

Assuming that this array of objects is in `msg.payload` then a simple Javascript function would work:

```auto
msg.payload = msg.payload.filter(o => o.visible);
return msg;

```

Since you said you don't want to use the `function` node, I would tend to use a `change` node with this JSONata expression:

```auto
payload[visible=true]

```

Actually, I was surprised to see that there is no built-in core node called `filter` or some such thing... I thought there was one. Did I just miss it?

---

<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:** [16 February 2021 15:43 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096/3 "2021-02-16T15:43:26Z")

</div>

Try using change node and JSONata

```auto
payload[visible=true]

```

[edit] i see @shrickus already suggested it.

---

<div class="post-metadata">

**Author:** ![hrleinonen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hrleinonen/32/37329_2.png) [@hrleinonen](https://discourse.nodered.org/u/hrleinonen)\
**Post date:** [17 February 2021 04:55 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096/4 "2021-02-17T04:55:36Z")

</div>

Thank you, now I got it working.

Br,

Ville

---

<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:** [3 March 2021 04:56 UTC](https://discourse.nodered.org/t/help-to-filter-data/41096/5 "2021-03-03T04:56:04Z")

</div>

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