get()
Retrieves a specified document from storage.
uniface.datastore.get(
DocId)
Example:
uniface.datastore.get('songs_dsp')
Arguments
DocId—the identifier of the document that you want to retrieve.
Return Value
Returns a JavaScript Promise object. If the promise is resolved, the specified document is returned as an object. For example:
{ "_id": "songs_dsp", "_rev": "1-A6157A5EA545C99B00FF904EEF05FD9F" "title": "Rock and Roll Heart", }
Otherwise, an error is returned. For more information, see Promises and Errors.
Using get()
Assuming the data has been stored in a local
database under the _id
songs_dsp
, the following code retrieves
the data from local storage, and loads it into the current DSP instance:
// Look for the doc with id 'songs_dsp' and load its data to the current instance. uniface.datastore.get('songs_dsp').then(function (vData) { uniface.getInstance().setData(vData.title); }).catch(function (err) { console.log(err); });
Version | Change |
---|---|
9.7.03 (G304)
10.2.01 |
Introduced |