# Persistent Context Set Previous Value

**URL:** <https://discourse.nodered.org/t/persistent-context-set-previous-value/82697>\
**Category:** General\
**Created:** [7 November 2023 19:53 UTC](https://discourse.nodered.org/t/persistent-context-set-previous-value/82697 "2023-11-07T19:53:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PuckeyP](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/puckeyp/32/63446_2.png) [@PuckeyP](https://discourse.nodered.org/u/PuckeyP)\
**Post date:** [7 November 2023 19:53 UTC](https://discourse.nodered.org/t/persistent-context-set-previous-value/82697/1 "2023-11-07T19:53:00Z")

</div>

Hi All,  
Question: Is it possible to set previous value for a global value, or should I just send two values pushing the first one to the previous value state  
Thx  
PPee

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [7 November 2023 19:58 UTC](https://discourse.nodered.org/t/persistent-context-set-previous-value/82697/2 "2023-11-07T19:58:23Z")

</div>

Sorry, I'm trying to work that out.  
You want to restore a value that was previously changed?

if so, yes - you need to store it somewhere, so you can re-call the value, to restore it.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 November 2023 20:05 UTC](https://discourse.nodered.org/t/persistent-context-set-previous-value/82697/3 "2023-11-07T20:05:35Z")

</div>

Maybe store as an array of two entries. Current and previous. Or as an object with myvar.current and myvar.previous.

---

<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:** [6 January 2024 20:06 UTC](https://discourse.nodered.org/t/persistent-context-set-previous-value/82697/4 "2024-01-06T20:06:23Z")

</div>

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