# Compare current data with data from the last 2 days

**URL:** <https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787>\
**Category:** General\
**Created:** [17 May 2021 13:47 UTC](https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787 "2021-05-17T13:47:09Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [2 June 2021 13:19 UTC](https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787/21 "2021-06-02T13:19:54Z")

</div>

Ok, lets look at your flow. First edit each of the `inject` nodes and set the intervals to `none` so you will have to press the inject to trigger it.

Next add a `debug` node ( set to dsplay the complete msg object) to the output of the `change` node.

Now run the 'conter' flow, look at the debug output and look at the function node. What do you notice?

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [2 June 2021 22:11 UTC](https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787/22 "2021-06-02T22:11:24Z")

</div>

You have your change node overwriting the variables in the 2nd functon - you are taking the value from yesterday and putting it into today (for example)

Have you read the previous links on Flow variables, context variables and persistence ?

Craig

---

<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:** [1 August 2021 22:11 UTC](https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787/23 "2021-08-01T22:11:55Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/compare-current-data-with-data-from-the-last-2-days/45787.md?page=1)
