HELP!

Using the Special "xpertrule" Object

The special Viabl.ai Object xpertrule has the following methods and properties which can be accessed within JavaScript Scripts:

Method Description
.buildAllObjectData() Returns an object containing all objects which have a value (whether captured, pre-supplied or assigned)
.buildOutputObject(excludeEmptyObjects) Returns an object containing objects specified as "outputs" in the KB (option to include / exclude empty objects)
.capturedObjects() Returns the captured objects IDs of the inference session to this point.
.chain(moduleName) Programatically chains to the specified module (in the project)
.dataMsg([returnMessage]) When inputs & outputs are specified as being "raw JSON", this method allows the getting and setting of the input & output message
.decodeData() This method decodes the input string parameter into object values
.disableUI([cssProperties]) Disable the User Interface.
.enableUI() Re-enable the (previously .disableUI) User Interface.
.encodeData() This method returns a JSON string containing the values of the specified Objects and/or Objects captured during this inference session up to this point.
.engine_version Returns an integer representing the specific Viabl.ai engine version
.extendTrace(ident, value) Adds a custom line to the runtime trace which is visible in the trace window
.findObject(name or id) Find the Viabl Platform internal object from the given name or id.
.flashMessage(message [,duration]) Show a message at the bottom of the screen for duration seconds.
.getValues(objectIDs) Returns JavaScript object which holds the specified dictionary objects' values.
.instances(objectName) Returns an array containing all the defined List Values for the given object name.
.lineOfReasoning() This special method returns an array of all the executed Objects for the current runtime session
.kbVersion() Shows the current knowledge base version
.message(aContent, aTitle, aBtnTxt) Pops up a message dialog on the screen.
.messageJSON(aContent) Pops up a prettified JSON message dialog on the screen.
.processUtterance(objectRef, utterance[, dontAutoAssign]) This tries to calculate the value to assign to a specified object given a free-form text utterance
.once(function()) One time call for synchronous operations.
.onceAsync(function(completeCB)) One time call for asynchronous operations.
.restart() Restarts the inference, clearing all object values from the .restartPos() node.
.runMode() Returns a flag to indicate the current runtime environment.
.setGlobalEventHook(eventFn) Attaches a callback function which gets called in response to various inference situations.
.setValues(valueObject) Set dictionary object values via the supplied JavaScript object.
.suspend([suspendData, [settings]]) Suspend the inference (this method is used by the "Add Workflow Suspend" build tool)
.terminate(errorMessage) Display an error message and halt inference.
.trace() Returns the trace object as a string.
.translate(kbText)" This tries to retrieve the translation for the supplied string. If a match is not found (or no translation applied at deploy time) the supplied text is returned.
.urlFetch(aURL, postData) Makes an HTTP request to a web server with optional post data parameters.
There maybe other undocumented internal methods and properties of this special Object which are not intended for general use.

On This Page