Database Utilities

Methods

(inner) clearCache(serverDatabase, nameopt)

Clears the local documents cache for the specified service.

This will force documents to be read from the server. Caution: changes to documents not saved will be lost.

Parameters:
NameTypeAttributesDescription
serverDatabase*

contains the server name (optional) and object service name.

namestring<optional>

table/object name within the service. If no table name is specified, all documents are cleared.

(inner) documentSave(serviceEntry, formName, formDocument) → {Promise.<boolean>}

Saves the document to the server.

Parameters:
NameTypeDescription
serviceEntry*

entry for an Object Service

formName*

form name

formDocument*

form document object

Returns:
Type: 
Promise.<boolean>

(inner) fetchAllViewDocuments(pageSize) → {Promise.<any>}

Fetch all view documents using six concurrent promises. Increases performance when reading a large number of documents from the server.

Parameters:
NameTypeDefaultDescription
pageSize*10

number of document to read concurrently.

Returns:
Type: 
Promise.<any>

(inner) getCurrentDocument() → {object}

Returns the current Form document from the local cache.

Returns:
Type: 
object

(inner) getCurrentViewDocument() → {object}

Returns the current View document from the local cache.

Returns:
Type: 
object

(inner) getDocument(formName, UNID) → {Promise.<object>}

Gets document using form name and UNID and makes it the current document. Document is loaded from server if not in local cache.

Parameters:
NameTypeDescription
formName*

form name.

UNID*

Unique ID of the document

Returns:
Type: 
Promise.<object>

(inner) getFormFromUNID(UNID) → {Promise.<string>}

Get form from document UNID. Only works when using online access.

Parameters:
NameTypeDescription
UNID*

Unique ID of the document.

Returns:
Type: 
Promise.<string>

(inner) getLastError(serviceEntry) → {Error}

Returns the last Error occurring in Service.

Parameters:
NameTypeDescription
serviceEntry*

entry for an Object Service

Returns:
Type: 
Error

(inner) getObjectMetadata(serviceEntry, objectName, keywords) → {Promise.<Array>}

Returns the table/object metadata.

Parameters:
NameTypeDescription
serviceEntry*

entry for an Object Service

objectName*

table/object name

keywords*

[FAILSILENT] causes empty results to be returned if an error occurs

Returns:
Type: 
Promise.<Array>

(inner) getServiceEntry(serverDatabase) → {class}

Returns the serviceEntry class for the Object Service.

Parameters:
NameTypeDescription
serverDatabase*

contains the server name (optional) and object service name

Returns:
Type: 
class

(inner) getServiceName(serverDatabase) → {string}

Returns the Object Service name contained in the serverDatabase string.

Parameters:
NameTypeDescription
serverDatabase*

contains the server name (optional) and object service name

Returns:
Type: 
string

(inner) getServiceObject(serverDatabase, name) → {any}

Returns a table/object from the Object Service.

Parameters:
NameTypeDescription
serverDatabase*

contains the server name (optional) and object service name

name*

table/object name within the service

Returns:
Type: 
any

(inner) setCurrentDocument(formName, UNID) → {Promise.<object>}

Sets the current document using form name and UNID.

Parameters:
NameTypeDescription
formName*

form name.

UNID*

Unique ID of the document

Returns:
Type: 
Promise.<object>