AddStoreItem function

AddStoreItem() stores data (JavaScript primitive values or objects) in a memory storage area for the duration of that DeltaV Live session. These data remain available in the storage area throughout the DeltaV Live session, even after the configuration is refreshed or reset.

Normally, layout variables return to their configured initial values when a Deltav Live user performs a Refresh Configuration online. However, by calling AddStoreItem() in a layout's "OnClose" event handling script and GetStoreItem() in a layout's "OnOpen" event handling script, any layout-scope data that was called by AddStoreItem() when the layout was closed is retrieved again by GetStoreItem() when the refreshed layout reopens.
Note:
Calling AddStoreItem() replaces any existing stored data having an identical key string.
Arguments
2
Argument Description
key The unique name of the data item to be stored for retrieval by GetStoreItem(), within the scope of this instance of DeltaV Live. The key is case sensitive.
data Any JavaScript primitive value or object.
Return values
None
Syntax
DL.AddStoreItem(key, data)
Examples
Example Result
If you want the layout-scope variable, MyVar, to be added to the storage area for retrieval during a Refresh Configuration action, you could add the following expression to the layout's "OnClose" event handling script:
DL.AddStoreItem("Lyt.MyVar", Lyt.MyVar)
When the layout closes in DeltaV live, the value of the layout-scope variable, MyVar, is added to the storage area.