Cubic Compass Software

- Support Wiki



The 'xos' Javascript API provides client access to the i-Dialogue database for use in AJAX web applications.



xos.query("SELECT Id, SolutionName FROM Solution WHERE SolutionName CONTAINS 'test' OR SolutionNote CONTAINS 'test'", options, functionName_callback);


Supported Methods


Query methods

  • query(string XOSQL Query, xosOptions, callBackFunction)
  • getObject(objectID, callBackFunction)



A xosOptions object is constructed and the following options are passed to the query method:

useCache: The query will store the 'from' object collections (not results) in memory for up to one hour. Can provide 10x performance gain over base Query method when using complex queries.



xosOptions = new Object();
xosOptions.useCache = true;
xos.query("SELECT Id, SolutionName FROM Solution WHERE SolutionName CONTAINS 'test' OR SolutionNote CONTAINS 'test'", xosOptions, function_Callback);

A null value may be passed as the xosOptions argument.
xos.query("SELECT property FROM object", null, functionName_callback);


Search Methods

  • searchPages(string keywords, callback function)
  • searchDocuments(string repositoryName, string keywords, bool searchFullText, bool searchMetaTags, callback function)
  • getAllDocumentMetaTags(string repositoryName)


Social Methods

  • addRating(string objectID, int rating, callBack)
  • addVote(string objectID, int vote, callBack)
  • addComment(string objectID, string comment, callBack)
  • addTag(string objectID, string tag, callBack)


Cuboid Execution Methods

  • exec(string cuboidName, string arguments, callback function)

Arguments are a comma separated list and are accessible in cuboids through the string array 'args'.

Client-side Javascript Example
xos.exec('Resend Password', emailAddress, functionName_callback);

Call Cuboid Example
emailAddress = args[0]

//Lookup user by email and resend password here


AJAX Support

It's recommended to use the methods that support callback functions whenever possible. These methods execute the query or search, then immediately return control flow to the client javascript while the query gets processed asynchronously. When the query or search is completed, the callback function is passed a response object that contains error information (if any) and a JSON formatted object array.

For Query methods, the JSON object type is defined by the FROM keyword and the object properties are defined the SELECT keyword. For example, "SELECT Name, Author FROM PressRelease" returns an array of JSON objects of type "PressRelease" with properties for "Name" and "Author".

The searchPages and searchDocuments methods return "Page" and "Document" JSON objects respectively.

Page Properties: oid, url, title, abstract, keywords, viewCount, label
Document Properties: oid, createdDate, lastModifiedDate, url, title, abstract, author, publisher, viewCount, iconUrl


AJAX / JSON Example

function doSearch(keywords){
	var query = "SELECT Id, SolutionName FROM Solution WHERE SolutionName CONTAINS '" + keywords + "'";
	xos.query(query, doSearch_Callback);

function doSearch_Callback(response){
	if (response.error != null){
	var data;
	eval ("data = " + response.value);
	var html = new Sys.StringBuilder();
	for(var index=0; index < data.TableName.length; index++)
		html.append("<tr><td>" + data.TableName.PropertyName + "</td></tr>");



The xos interface enforces access policies for executing AJAX methods on the server. Allowed queries and calls to cuboid controllers are defined in the page source. Admin users and users with Edit permissions on the current page may execute any query.

Use of any xos query requires embedding <xos> XML query prototypes in the Dialogue Script that define allowed query execution patterns.


Example XOS execution policy syntax

			<query>select from Case where oid</query>

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam.