Skip to content

User Guide: SDKs > Cordova (PhoneGap) SDK > Invoking an Object Service > Data Transfer Objects > voltmx.sdk.dto.DataObject Class

voltmx.sdk.dto.DataObject Class

This class represents a data object in the Object Service. An instantiation of this class is required as a parameter in many methods of the OnlineObjectService Class and the OfflineObjectService Class.

Constructors

The voltmx.sdk.dto.DataObject class has one constructor.

voltmx.sdk.dto.DataObject(string objectName)

ParameterTypeDescription
objectNamestringName of object defined in the object service

Fields

Field nameTypeDescription
setOdataUrlstringSpecifies the Odata URL

Methods

The voltmx.sdk.dto.DataObject class includes the following methods.

addChildDataObject(child) Method

Adds another DataObject as a child..

Signature

addChildDataObject(child)

Parameters

ParameterTypeDescription
childvoltmx.sdk.dto.DataObjectThe DataObject to be added as a child

addField(fieldName, value) Method

Adds a field in the data object.

Signature

addField(fieldName, value)

Parameters

ParameterTypeDescription
fieldNamestringThe name of the field being added.
valuestringThe value of the added field

setRecord(record) Method

Specifies a record in the data object.

Signature

setRecord(record)

Parameters

ParameterTypeDescription
recordJSON objectThe record to be set.

setSelectQueryObject(queryObject) Method

Sets the specific query object to use in the query.

Signature

setSelectQueryObject(queryObject)

Parameters

ParameterTypeDescription
queryObjectvoltmx.sdk.dto.SelectQueryThe object that contains the query.

Example

 // **Simple Object**
var dataObject = new voltmx.sdk.dto.DataObject("objectName"); 
var record = {};  
record.field1 = "value1";  
record.field2 = "value2";  
record.field3 = "value3";
//sets the record to the dataObject  
dataObject.setRecord(record);
// **Complex Object**  
var parentDataObject = new voltmx.sdk.dto.DataObject("parentObject"); 
var record = {}; 
record.field1 = "value1"; 
record.field2 = "value2"; 
record.field3 = "value3";
//sets the record to the parent. 
parentDataObject.setRecord(record); 
var childDataObject = new voltmx.sdk.dto.DataObject("childObject"); 
var record = {}; 
record.field4 = "value3"; 
record.field5 = "value5"; 
record.field6 = "value6";
//sets the record to the child
childDataObject.setRecord(record); 
parentDataObject.addChildDataObject(childDataObject); // **Adding OdataUrl**  
var dataObject = new voltmx.sdk.dto.DataObject("objectName"); 
dataObject.setOdataUrl("$filter=abc eq 123");