IGrooveFormsToolSessionData Interface

The IGrooveFormsToolSessionData interface provides a mechanism for storing global data for a Forms tool session.

Methods

Method Description

DeleteData

Deletes stored data with the specified name.

DoesDataExist

Tests if data is stored with the specified name.

GetData

Gets the value of data stored with the specified name.

SetData

Sets the value of data stored with the specified name.

Remarks

You can use session data to store values that are preserved from one record to another. For example, form scripts set initial values for new records based on the values is the previous record created in the session. To do this, the script stores the values in session data when a new record is saved and then uses these values when it initializes a form for a new record. Session data is stored as a variant value associated with a name. The SetDatamethod defines the name and assigns the value to it. If the name is already defined, SetData assigns the new value to it. GetDatagets the current value assigned to the name. If the name has not been defined or if it has been deleted, GetData produces a script error. Consequently, you should use the DoesDataExistmethod to check if a name is defined before getting its value.

Session data is preserved as long as the Groove user is accessing the Forms tool user interface. If the user leaves the tool to work in another tool in the workspace or closes the workspace, the session data may be lost. In some cases, Groove defers deleting the session data for efficiency reasons; consequently, it is possible that the data will be preserved if the user leaves the tool tab and then returns to it. Session data is not preserved from one Groove session to another and is local to the user's device. It is not replicated to other users or to other devices of the same user.

Example

To get access to the IGrooveFormsToolSessionData object, get the interface from the IGrooveFormsToolUIDelegate object available from the GetApp() Public Script Functions.

var SessionData = GetApp().IGrooveFormsToolSessionData;
if (!SessionData.DoesDataExist("NewData"))
{
  // if data is not defined, initialize it
  SessionData.SetData("NewData", 123);
}
// ...
// If data is obsolete, delete it
SessionData.DeleteData("NewData");

See Also

Reference

IGrooveFormsToolApplicationPreferences Interface