# Persistence of data in global dictionary?

**URL:** <https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [July 1, 2020, 7:46am UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237 "2020-07-01T07:46:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://forum.inductiveautomation.com/u/nok)\
**Post date:** [July 1, 2020, 7:46am UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/1 "2020-07-01T07:46:09Z")

</div>

Hi all

I have an Ignition Edge 8.0.14 licensed with the Compute module. Thus I have Gateway Event Scripts.  
In the scope of these scripts it appears that all data in the global dictionary (as retrieved by system.util.getGlobals()) are cleared every time I save my project to the gateway (at least when there are changes to the scripts). Is that how it is supposed to work? I was hoping data in that dictionary was persistent at least when the project. I believe that was how the “standard” Ignition was working…

---

<div class="post-metadata">

**Author:** ![KMuldoon](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@KMuldoon](https://forum.inductiveautomation.com/u/KMuldoon)\
**Post date:** [July 1, 2020, 8:16am UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/2 "2020-07-01T08:16:55Z")

</div>

Looking into the documentation, it seems like when the scope that the global dictionary is in has been altered, it would then be ‘refreshed’ and emptied.

[https://docs.inductiveautomation.com/display/DOC80/system.util.getGlobals](https://docs.inductiveautomation.com/display/DOC80/system.util.getGlobals)

Since you are using Ignition 8, I would suggest using a memory tag with a Document datatype and push your dictionary into there. Not quite as convenient as accessing the global dictionary, but it should survive any scope restarts.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2020, 12:26pm UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/3 "2020-07-01T12:26:17Z")

</div>

It used to not be emptied. Which breaks a great deal of the code I use to manage lifetimes for asynchronous threads. Since IA seems to be oblivious about the significance of this, I created a special module (free) just for this purpose, announced here:

> [@system.util.getGlobals() not persisted across Designer Save](http://forum.inductiveautomation.com/t/system-util-getglobals-not-persisted-across-designer-save/33869/14):
>
> Ok. New module “Life Cycle” w/ system.util.persistent(name) utility function. For v7.9: [https://www.automation-pros.com/ignition/Life%20Cycle-0.9.0.2004121825.modl](https://www.automation-pros.com/ignition/Life%20Cycle-0.9.0.2004121825.modl) For v8.0: [https://www.automation-pros.com/ignition/Life%20Cycle-0.9.0.2004121920-v8.modl](https://www.automation-pros.com/ignition/Life%20Cycle-0.9.0.2004121920-v8.modl) Test with a project script like this: # project script "Life" g = system.util.persistent('LifeTest') count = g.setdefault('editCount', -1) count += 1 g['editCount'] = count def editCount(): return count Print the return from Life.editCou…

---

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://forum.inductiveautomation.com/u/nok)\
**Post date:** [July 1, 2020, 12:42pm UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/4 "2020-07-01T12:42:51Z")

</div>

OK, thanks a lot, I’ll try that.

---

<div class="post-metadata">

**Author:** ![nok](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@nok](https://forum.inductiveautomation.com/u/nok)\
**Post date:** [July 1, 2020, 12:48pm UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/5 "2020-07-01T12:48:40Z")

</div>

Hi Phil, your module doesn’t install on Ignition Edge. I get a state " Faulted: Not eligible for use with Ignition Edge, unless licensed"

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 1, 2020, 12:56pm UTC](https://forum.inductiveautomation.com/t/persistence-of-data-in-global-dictionary/36237/6 "2020-07-01T12:56:17Z")

</div>

Ah, yes, Edge has a whitelist of eligible modules, and mine aren’t on it. Sorry. Your sales agent at IA can help, though.
