# Totalizer difference example

**URL:** https://discourse.nodered.org/t/totalizer-difference-example/40949
**Category:** General
**Created:** [13 February 2021 22:34 UTC](https://discourse.nodered.org/t/totalizer-difference-example/40949 "2021-02-13T22:34:17Z")
**Posts on this page:** 1
**Showing post:** 20

<div class="post-metadata">

### Author: ![bkenobi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bkenobi/32/59825_2.png) [@bkenobi](https://discourse.nodered.org/u/bkenobi)
#### Post date: [18 February 2021 20:58 UTC](https://discourse.nodered.org/t/totalizer-difference-example/40949/20 "2021-02-18T20:58:34Z")

</div>

I changed my code to match your approach. I am not sure if the context is set to store to memory of file though. I have "file" in the set and get statements, but according to the guide I'm using, it looks like I may need to change the settings.js file?

> [@A guide to understanding 'Persistent Context'](https://discourse.nodered.org/t/a-guide-to-understanding-persistent-context/4115):
>
> This is something I wrote up after playing with the context options. I've filed a PR with some of this added to the Node-RED documentation but thought I'd release it here also. I hope people find it useful. Paul A guide to understanding 'Persistent Context' Prior to Node-RED v0.19.0, data could be stored in context as a global, flow or node. This was stored in memory and would be reset with a restart of Node-RED. As of v.0.19.0 you can now store node, flow and global context data in memory O…

```auto
    contextStorage: {
    	default : { module: "memory" },
		storeInFile: { module: "localfilesystem"},
		memoryOnly : { module: "memory" }
    },

```

Perhaps that's the default setting since I'm not seeing an error and it appears that the value is getting stored.

---

_[View the full topic](https://discourse.nodered.org/t/totalizer-difference-example/40949)._
