GetStoreItem function

GetStoreItem() retrieves data that has been stored, using AddStoreItem(), during this DeltaV Live session. The data is retrieved when a DeltaV Live user performs a Refresh Configuration action.

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.

Arguments
1
Argument Description
key string The unique name of the data item to be retrieved from the storage area. The key string is case sensitive.
Return values (any)
  • The primitive value or object that was stored, if a data item with a matching key string supplied by an previous AddStoreItem() is present.
  • Otherwise, the configured default value.
Syntax
DL.GetStoreItem(key string)
Examples
Example Result
If you want to retrieve the value for the layout-scope variable, MyVar, when the layout configuration is refreshed, you could use the following expression in the layout's "OnOpen" event handling script.
let temp = DL.GetStoreItem("Lyt.MyVar");
if (temp !== undefined)
	Lyt.MyVar = temp;  // recover it if in the store
// else keep the initial value configured for my variable
When the DeltaV Live user clicks the Refresh Configuration button, the variable, MyVar, retrieves the value stored by AddStoreItem().