# Increase / Decrease

**URL:** <https://discourse.nodered.org/t/increase-decrease/14600>\
**Category:** General\
**Created:** [21 August 2019 12:08 UTC](https://discourse.nodered.org/t/increase-decrease/14600 "2019-08-21T12:08:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rednig](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@Rednig](https://discourse.nodered.org/u/Rednig)\
**Post date:** [21 August 2019 12:08 UTC](https://discourse.nodered.org/t/increase-decrease/14600/1 "2019-08-21T12:08:14Z")

</div>

Hi,

Im quite new to Node-Red but have begun my journey to learn more about it, atm. im have a device giving me the following input:

msg.payload : Object

object  
ts: 1566388338405  
objects: array[2]  
0: object  
frame: 1922815  
oid: 5794  
x0: 0.665  
x1: 0.568  
y0: 0.557  
y1: 0.058  
type: "person"

1: object  
frame: 1922815  
oid: 5796  
x0: 0.707  
x1: 0.604  
y0: 0.509  
y1: 0.057  
type: "person"

My interrest is how i can get:

1. The "oid" and send a count pr. "oid"
2. The x0/y0 if that count increase send a 1 and if decrease send a 0

Dont know if this is the right place to ask for this kind of help 🙂

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [21 August 2019 12:17 UTC](https://discourse.nodered.org/t/increase-decrease/14600/2 "2019-08-21T12:17:31Z")

</div>

You’ve got an array so you have multiple values of oid and x0 y0  
so do you want to compare the first  
with the second within one message

or between messages?

There’s a handy page in the docs which will show you how to get the path to a bit of data  
and then if you want to compare within the same message you could look at the switch node or a function node.

If you want to compare between messages then you will need to store the result somewhere as each node doesn’t have a memory of previous messages. Look at the docs about storing context and there are also some examples in the cookbook [cookbook.nodered.org](http://cookbook.nodered.org)

---

<div class="post-metadata">

**Author:** ![Rednig](https://avatars.discourse-cdn.com/v4/letter/r/a87d85/32.png) [@Rednig](https://discourse.nodered.org/u/Rednig)\
**Post date:** [21 August 2019 12:24 UTC](https://discourse.nodered.org/t/increase-decrease/14600/3 "2019-08-21T12:24:09Z")

</div>

I would like to check each Array message by them selv, because the oid is a unique ID, so in general i wanted to check that the oid value is now counted more then 1 time and then chekc the x0 y0 if that increase of decreases..

ill check the cookbook didn knew that one 🙂
