JSDO properties, methods, and events reference : saveLocal( ) method
  

saveLocal( ) method

Saves JSDO memory to a specified local storage area, including pending changes and any before-image data, according to a specified data mode.
Return type: undefined
Applies to: progress.data.JSDO class

Syntax

saveLocal ( [ storage-name [ , data-mode ] ] )
saveLocal ( data-mode )
storage-name
The name of the local storage area in which to save the specified data from JSDO memory. If storage-name is not specified, blank, or null, the name of the default storage area is used. The name of this default area is jsdo_serviceName_resourceName, where serviceName is the name of the Data Object Service that supports the JSDO instance, and resourceName is the name of the resource (table, dataset, etc.) for which the JSDO instance is created.
data-mode
A JSDO class constant that specifies the data in JSDO memory to be saved to local storage. Each data mode initially clears the specified local storage area of all its data, then replaces it with the data from JSDO memory as specified. The possible values include:
*progress.data.JSDO.ALL_DATA — Replaces the data in the storage area with all the data from JSDO memory, including pending changes and any before-image data. This is the default data mode.
*progress.data.JSDO.CHANGES_ONLY — Replaces the data in the storage area with only the pending changes from JSDO memory, including any before-image data.
If this method encounters any errors, it leaves the specified storage area unchanged and throws an exception.
This method supports any schema that the JSDO supports.
Note: If you want to save JSDO memory to local storage after the JSDO saveChanges( ) method fails in response to an offline condition, be sure to set the autoApplyChanges property on the JSDO to false before calling this method for the first time. You can then continue to save JSDO memory to protect against a local session failure as it accumulates further offline changes until the mobile app goes back online and saveChanges( ) succeeds in saving the changes to the server.
You can also use this method to routinely cache static data, such as state and rate tables, that might not change often, allowing for faster startup of the mobile app. One way to do this is to define a JSDO for a resource that accesses only static data, and invoke this method after refreshing JSDO memory using the fill( ) method. When caching data in general, be sure to save JSDO memory when it is in a consistent state, such as immediately after successful invocation of the JSDO fill( ) or saveChanges( ) method (in the relatively rare case where routinely static data is being updated).

Example

The following code fragment caches JSDO memory for a JSDO defined with static data immediately after it is loaded into JSDO memory:
dataSet = new progress.data.JSDO( 'dsStaticData' );
dataSet.fill();
dataSet.saveLocal();
In this case, all the data in JSDO memory is cached to the default storage area.

See also:

acceptChanges( ) method, autoApplyChanges property, fill( ) method, readLocal( ) method, rejectChanges( ) method, saveChanges( ) method