# Anomalous behaviour - Batch Node

**URL:** <https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741>\
**Category:** General\
**Created:** [26 July 2020 19:47 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741 "2020-07-26T19:47:14Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [26 July 2020 19:47 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/1 "2020-07-26T19:47:15Z")

</div>

v1.1.2

I'm seeing some strange behaviour from the batch node.

I am trying to do a sliding window calculation on an array and getting some strange results when I change the nodes parameters.  
After changing the parameters to the following the first time I trigger the flow it performs as I expect, when I trigger it the second time it wraps around the end of the array.  
 ![Screenshot-25](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/436b94d768688153677ca23f177bf01def901622.png)  
 ![Screenshot-26](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d0f7a923319faf8a14d855369ca44e5425d6012.png)

1st trigger of the flow:  
 ![Screenshot-27](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5a25ee00f0b89793b5b684b7988060558b759fb7.png)

2nd and subsequent triggers:  
 ![Screenshot-28](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7cfee6c003e6c7b1a5ed093f1ba51f22464d47a2.png)

I would have thought that the first trigger results are correct? Definitely something wrong, or am I missing something?

Example flow:

```auto
[{"id":"287fe1a.bbf611e","type":"inject","z":"cf21b550.de9ba8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]","payloadType":"jsonata","x":110,"y":80,"wires":[["6a776a01.f070d4"]]},{"id":"6a776a01.f070d4","type":"split","z":"cf21b550.de9ba8","name":"","splt":"\\n","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":250,"y":80,"wires":[["5ee58042.23a3d"]]},{"id":"5ee58042.23a3d","type":"batch","z":"cf21b550.de9ba8","name":"","mode":"count","count":"4","overlap":"3","interval":10,"allowEmptySequence":false,"topics":[],"x":390,"y":80,"wires":[["cb1f4b99.15e788"]]},{"id":"c629899a.af6528","type":"debug","z":"cf21b550.de9ba8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":750,"y":160,"wires":[]},{"id":"cb1f4b99.15e788","type":"join","z":"cf21b550.de9ba8","name":"","mode":"auto","build":"array","property":"payload","propertyType":"msg","key":"payload[0][0].Valid_From","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"2","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":530,"y":80,"wires":[["e68468eb.ce4768"]]},{"id":"e68468eb.ce4768","type":"join","z":"cf21b550.de9ba8","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload[0][0].Valid_From","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"2","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":610,"y":160,"wires":[["c629899a.af6528"]]}]

```

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 July 2020 20:54 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/2 "2020-07-26T20:54:09Z")

</div>

you asked for an overlap of three - so there are still 3 items of the previous input still there ready to be the overlap.

---

<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:** [26 July 2020 21:00 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/3 "2020-07-26T21:00:29Z")

</div>

OK Dave, now I understand. Is there any way I can emulate the first behaviour?  
[edit] I.e. without the wrap at the end.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 July 2020 21:04 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/4 "2020-07-26T21:04:49Z")

</div>

the end of the info says... " If a message is received with the **msg.reset** property set, the buffered messages are deleted and not sent."

---

<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:** [26 July 2020 21:07 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/5 "2020-07-26T21:07:19Z")

</div>

Being able to read is a virtue 🙂

---

<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:** [9 August 2020 21:07 UTC](https://discourse.nodered.org/t/anomalous-behaviour-batch-node/30741/6 "2020-08-09T21:07:27Z")

</div>

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