# Add an var with memory var

**URL:** https://discourse.nodered.org/t/add-an-var-with-memory-var/45591
**Category:** Developing Nodes
**Created:** [13 May 2021 13:43 UTC](https://discourse.nodered.org/t/add-an-var-with-memory-var/45591 "2021-05-13T13:43:18Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Ranki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ranki/32/41282_2.png) [@Ranki](https://discourse.nodered.org/u/Ranki)
#### Post date: [14 May 2021 00:20 UTC](https://discourse.nodered.org/t/add-an-var-with-memory-var/45591/6 "2021-05-14T00:20:31Z")

</div>

Hello Dimpie,

Welcome to the community and good to see that you found your first solution here. 🙂

I just want to point you to an alternative solution I found in the forum these days to add/ increment easily a value to a global variable:

> [@Increment a global variable with a change node](https://discourse.nodered.org/t/increment-a-global-variable-with-a-change-node/44893/2):
>
> Yes that's possible' Set Global metric JSONata expression $globalContext("metric") + 1

Might reduce lines in the code 🙂

Cheers  
Ranki

---

_[View the full topic](https://discourse.nodered.org/t/add-an-var-with-memory-var/45591)._
