Access the storage functions, which allow you to specify a cache that stores results from online requests.

These functions give you the ability to:
  • Name the cached result sets
  • Enumerate the cached result sets
  • Read, delete, and modify cached contents individually for each cached result set

Cached result sets must be stored as strings (before deserialization to an xmlWorkflowMessage structure).

Method Description
SUPStorage(store) Provides encrypted storage of name value pairs. Results from online requests are one example. Strings stored in SUPStorage are encrypted and persisted to survive multiple invocations of the mobile workflow application.
SharedStorage() Used to construct a new shared SUP storage. You can use the returned value to access the shared storage data with the exising SUPStorage interface, however, the operation only affects the items belonging to the specified shared storage key.
getSharedStorageKey() Used to return the shared storage key defined for the mobile workflow application during design time. An empty string is returned if the shared storage function is disabled.
isSharedStorageEnabled() Indicates whether the shared storage is enabled for the current workflow application.
SUPStorage.prototype.length() Gets the number of available keys in this object. Retrieve the keys themselves by using key().

length – returns the number of key/value pairs currently present in the list

SUPStorage.prototype.key(index) Returns the key at the supplied index. Keys are guaranteed to remain at the same index until a modification is made.
SUPStorage.prototype.getItem(key) Retrieves the value associated with the specified key. Returns a copy of the current value associated with the given key. If the given key does not exist in the list, null is returned.
SUPStorage.prototype.setItem(key, value) Sets the value associated with a specified key. This replaces the key’s previous value, if any. If the given key does not exist in the list, a new key value is added to the list with the given key and with its value set to a copy of value.
SUPStorage.prototype.clear() Removes all key/value pairs from this object.
SUPStorageException(code, message) Constructs a new SUPStorageException object.

Calls to these methods do not trigger events.

Example 1

- constructor
// The following script creates a 2 local storage instances with their own domain
var store1 = new SUPStorage("mydomain");
var store2 = new SUPStorage("myotherdomain");

Example 2

- length
// The following script displays the current number of elements in the storage
var store = new SUPStorage();

Example 3

- key(index)
// The following script displays the value at the provided index in the storage
var store = new SUPStorage();

Example 4

- getItem(key)

// The following script displays the value for the provided key
var store = new SUPStorage();

Example 5

- setItem(key, value)
// The following script sets a key/value pair
var store = new SUPStorage();
store.setItem("mykey", "myvalue");

Example 6

- removeItem(key)
// The following script removes a key/value pair
var store = new SUPStorage();

Example 7

- clear
// The following clears the storage
var store = new SUPStorage();
Related reference
AttachmentViewer and Image Limitations