# Filter false payloads

**URL:** https://discourse.nodered.org/t/filter-false-payloads/57359
**Category:** General
**Created:** [27 January 2022 18:06 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359 "2022-01-27T18:06:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![maliheh.amirfakhry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maliheh.amirfakhry/32/55147_2.png) [@maliheh.amirfakhry](https://discourse.nodered.org/u/maliheh.amirfakhry)
#### Post date: [27 January 2022 18:06 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/1 "2022-01-27T18:06:23Z")

</div>

Hi guys, I have to filter false payloads out. I'd like to have the payload values at the output If the payload value did not change over a period of time, e.g. on a 100 ms period or longer, otherwise nothing at the output, Can you please let me know how?

---

<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: [27 January 2022 18:40 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/3 "2022-01-27T18:40:04Z")

</div>

You will need to use multiple nodes. there a various ways.  
here is an example the use a join node set to timeout after 100ms, the switch node then determines if the distinct count is 1, and passes the msg if so. The change node just returns the first unchanged message within timeout.  
eg.

```auto
[{"id":"a0958109.bf19d","type":"inject","z":"c791cbc0.84f648","name":"single message","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":230,"y":1840,"wires":[["9ec224a5.5fef9"]]},{"id":"9ec224a5.5fef9","type":"join","z":"c791cbc0.84f648","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"0.1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":530,"y":1900,"wires":[["e34b6332.fcae08"]]},{"id":"e34b6332.fcae08","type":"switch","z":"c791cbc0.84f648","name":"","property":"$count($distinct(payload))","propertyType":"jsonata","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":660,"y":1900,"wires":[["c90747bf.ad5b18"]]},{"id":"f4e7bdc1.853ad8","type":"trigger","z":"c791cbc0.84f648","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"50","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":200,"y":2020,"wires":[["9ec224a5.5fef9"]]},{"id":"d952d96d.4b965","type":"trigger","z":"c791cbc0.84f648","name":"","op1":"true","op2":"true","op1type":"bool","op2type":"bool","duration":"50","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":200,"y":1920,"wires":[["9ec224a5.5fef9"]]},{"id":"c90747bf.ad5b18","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":1900,"wires":[["2502e681.e4e682"]]},{"id":"53fc6dc.ec49f14","type":"inject","z":"c791cbc0.84f648","name":"two different messages","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":210,"y":1980,"wires":[["f4e7bdc1.853ad8"]]},{"id":"b7212981.b88128","type":"inject","z":"c791cbc0.84f648","name":"two messages identical","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"2","payloadType":"num","x":210,"y":1880,"wires":[["d952d96d.4b965"]]},{"id":"2502e681.e4e682","type":"debug","z":"c791cbc0.84f648","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":1960,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 January 2022 18:50 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/4 "2022-01-27T18:50:56Z")

</div>

Ignore my first post, try this:

```auto
[{"id":"e413a61d9480ecbb","type":"tab","label":"Flow 6","disabled":false,"info":"","env":[]},{"id":"e6d0f034ca19ab8b","type":"rbe","z":"e413a61d9480ecbb","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","topi":"topic","x":260,"y":120,"wires":[["6d9b3008a343540a"]]},{"id":"6d9b3008a343540a","type":"trigger","z":"e413a61d9480ecbb","name":"","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"100","extend":true,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":520,"y":120,"wires":[[]]}]

```

---

<div class="post-metadata">

### Author: ![maliheh.amirfakhry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maliheh.amirfakhry/32/55147_2.png) [@maliheh.amirfakhry](https://discourse.nodered.org/u/maliheh.amirfakhry)
#### Post date: [27 January 2022 19:21 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/5 "2022-01-27T19:21:06Z")

</div>

Amazing , Thanks

---

<div class="post-metadata">

### Author: ![maliheh.amirfakhry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/maliheh.amirfakhry/32/55147_2.png) [@maliheh.amirfakhry](https://discourse.nodered.org/u/maliheh.amirfakhry)
#### Post date: [27 January 2022 19:22 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/6 "2022-01-27T19:22:04Z")

</div>

Thank you, for this and my previous post.

---

<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: [28 March 2022 19:22 UTC](https://discourse.nodered.org/t/filter-false-payloads/57359/7 "2022-03-28T19:22:33Z")

</div>

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