Anywhere API Reference - Application

Main page of the Anywhere API Reference

The Application class provides few methods to add and retrieve data sets (ModelDataSet) from the app cache.
In previous versions of Anywhere the Application class were used also for UI navigation. Now most of these methods are deprecated and replaced by the corresponding versions in UserInterface class: showDialog, show, hideDialog, hideCurrentDialog, hideAllDialogs, getCurrentView, etc.

showBusy() / hideBusy()

Displays and hides the hourglass. To be used to notify user of long operations.

Examples

self.ui.application.showBusy();

// perform a long operation using a promise
ModelService.save(woSet).then(function()
{
  self.ui.application.hideBusy();
  self.ui.hideCurrentView();
}).otherwise(function(error) {
  self.ui.application.hideBusy();
  self.ui.showMessage(error);
});

addResource(resource)

Adds a ModelDataSet to the app cache.

Examples

ModelService.filtered('classstructure',
null, filter, 1000, false, true).then(function (dataSet) {
  dataSet.resourceID = 'classstructure';
  dataSet.sort('classificationid');
  eventContext.application.addResource(dataSet);
  deferred.resolve(dataSet);
}).otherwise(function(e){
  deferred.reject(new PlatformRuntimeWarning('error fetching classstructure info'));
});

getResource(resourceName, [queryBase], [resourceid])

Retrives the specified data set (ModelDataSet) from the app cache.

Parameters

  • resourceName
  • queryBase (optional)
  • resourceid (optional)

Examples

var woSet = eventContext.application.getResource('workOrder');
var wo = woSet.getCurrentRecord();

getCurrentDateTime()


Examples

if (readingEntry.getAsDateOrNull('newreadingdate') == null) {
  readingEntry.setDateValue('newreadingdate', this.application.getCurrentDateTime());
}

showMessage(message, [callback])

Deprecated.
See UserInterface.showMessage(message, callback).


No comments:

Post a Comment