Offline validation tools - client store content

From PegaWiki
Offline validation tools - Client Store content / This is the approved revision of this page, as well as being the most recent.
Jump to navigation Jump to search

Offline validation tools - client store content

Description Described tools give apps developer possibility to see the offline apps database content on the device.
Version as of 7.2
Application Platform
Capability/Industry Area Mobile



Getting started[edit]

This document provides descriptions and usage of the functions that are included in the pzpega_mobile_settings.js script that is used to display the content of the client store.

To use the functions that are described in this document, you must run the mobile client on an emulator. Next, you must run a Chrome/web inspector, in which you can perform the following functions according to the specified example for each function.

This information applies to Pega Platform™ version 7.2.1 and later.

Functions[edit]

getItemTypes[edit]

Definition[edit]

launchbox.PRPC.ClientStore.getItemTypes(successCallback, failureCallback)

Returns array of all type names that are present in offline_store SQL table in offline application. The type names can then be used in functions, such as launchbox.PRPC.ClientStore.getItems(...)

For more information, see Client Store API for Pega Mobile Client.

Parameters[edit]

Parameter Description
successCallback Runs after getItemTypes(…) runs successfully. The function takes one parameter: an array with type names found by getItemTypes(…)
failureCallback Runs in case of failure. The function takes two parameters: errorCode and message

Example[edit]

var successCallback = function(results){
    console.table(results);
}

var failureCallback = function(errorCode, message){
    console.error(errorCode + " - " + message);
}

launchbox.PRPC.ClientStore.getItemTypes(successCallback, failureCallback);

getItems[edit]

Definition[edit]

launchbox.PRPC.ClientStore.getItems(type, handle, successCallback, failureCallback)

Returns array of all items of the selected type. Valid type names can be found with launchbox.PRPC.ClientStore.getItemTypes(...)

For more information, see Client Store API for Pega Mobile Client.

Parameters[edit]

Parameter Description
type Name of the type.
handle Rule id (class name, exclamation mark and rule name, e.g. “MY-CLASS-NAME!MyRuleName”). You can also use “*” to ignore handle and get all rules matching the specified type.
successCallback Runs after getItems(…) runs successfully. The function takes one parameter: an array with item names found by getItems(…)
failureCallback Runs in case of failure. The function takes two parameters: errorCode and message

Example[edit]

var type = "PORTALDATA";

var handle = "*";
    
var successCallback = function(results){
    console.table(results);
}

var failureCallback = function(errorCode, message){
    console.error(errorCode + " - " + message);
}

launchbox.PRPC.ClientStore.getItems(type, handle, successCallback, failureCallback);

getItemsStats[edit]

Definition[edit]

launchbox.PRPC.ClientStore.getItemsStats(successCallback, failureCallback)

Returns array of all items with type, handle and size attributes that are present in offline_store SQL table in offline application.

For more information, see Client Store API for Pega Mobile Client.

Parameters[edit]

Parameter Description
successCallback Runs after getItemsStats(…) runs successfully. The function takes one parameter: an array with items found by getItemsStats(…)
failureCallback Runs in case of failure. The function takes two parameters: errorCode and message

Example[edit]

var successCallback = function(results){
    console.table(results);
}

var failureCallback = function(errorCode, message){
    console.error(errorCode + " - " + message);
}

launchbox.PRPC.ClientStore.getItemsStats(successCallback, failureCallback);

customTableSizes[edit]

Definition[edit]

launchbox.PRPC.ClientStore.customTableSizes(tableNames, successCallback, failureCallback)

Returns information for large data pages.

For more information, see Client Store API for Pega Mobile Client.

Parameters[edit]

Parameter Description
largeDataPageNames An array with large data page names.
successCallback Runs after customTableSizes(…) runs successfully. The function takes one parameter: an array with custom table sizes found by customTableSizes(…)
failureCallback Runs in case of failure. The function takes two parameters: errorCode and message

Example[edit]

var largeDataPageNames = ["D_EmployeeList", "D_TelephoneList"];

var successCallback = function(results){
    console.table(results);
}

var failureCallback = function(errorCode, message){
    console.error(errorCode + " - " + message);
}

launchbox.PRPC.ClientStore.customTableSizes(largeDataPageNames, successCallback, failureCallback);

listActions[edit]

Definition[edit]

launchbox.PRPC.ClientStore.listActions(successCallback, failureCallback, getDetails)

Retrieves a list of actions that are queued for synchronization.

For more information, see Client Store API for Pega Mobile Client.

Parameters[edit]

Parameter Description
successCallback Runs after listActions(…) runs successfully. The function takes one parameter: array of actions found by listActions(…)
failureCallback Runs in case of failure. The function takes two parameters: errorCode and message
getDetails Boolean value. When true, function get more details about the result.
options Options that are used to filter actions:
  • lax (Boolean) whether to include (true) or exclude (false) lax actions in count, if not present then both lax and non lax actions are selected,
  • silent (Boolean) whether to include (true) or exclude (false) silent actions in count, if not present then both silent and non silent actions are selected,
  • negligible (Boolean) whether to include (true) or exclude (false) negligible actions in count, if not present then both negligible and non negligible actions are selected.

Example[edit]

var getDetails = true;

var options = {lax:false, silent:false, negligible:false};

var successCallback = function(results){
    console.table(results);
}

var failureCallback = function(errorCode, message){
    console.error(errorCode + " - " + message);
}

launchbox.PRPC.ClientStore.listActions(successCallback, failureCallback, getDetails, options);