01.06.2013 Views

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

OpenEdge Development: Mobile Applications - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

table reference property (JSDO)<br />

table reference property (JSDO)<br />

A property on a JSDO that has the name of a temp-table mapped by the <strong>Mobile</strong><br />

resource for which the current JSDO is created. Its value is a reference (table<br />

reference) to the temp-table object in JSDO local storage. This temp-table object<br />

provides access to the working record, if defined, of the temp-table. If a <strong>Mobile</strong><br />

resource maps a ProDataSet, its JSDO provides one table reference for every<br />

temp-table in the ProDataSet.<br />

Data type: Temp-table object reference in JSDO local storage<br />

Access: Read-only<br />

Applies to: progress.data.JSDO class<br />

In syntax wherever a table reference can be used, table-ref represents the name of<br />

the property containing the table reference. A referenced temp-table object provides<br />

the following properties:<br />

• record property— A reference to a JSRecord object that has the data for the<br />

working record of the temp-table through a data property. If no working record is<br />

defined for the temp-table, the record property is null.<br />

• field reference property — A property on the temp-table object that has the<br />

name of a field (as defined in the temp-table schema) and the value for that field<br />

in the working record, also referred to as a field reference. In syntax wherever a<br />

field reference can be used, field-ref represents the name of the property<br />

containing the field reference. A temp-table object provides one field reference for<br />

each field defined in the original temp-table. If no working record is defined, all field<br />

references are null, except when fields are referenced on the data property of a<br />

JSRecord object reference.<br />

Caution: Never write directly to a field-ref using this record property or any<br />

JSRecord object reference; in this case, use field-ref only to read the<br />

data. Writing to data using such a reference does not mark the record for<br />

update when calling the saveChanges( ) method. To mark a record for<br />

update, you must assign a field value either by setting a<br />

jsdo.table-ref.field-ref for a working record or by calling the<br />

assign( ) method on a valid table-ref or JSRecord object reference.<br />

You can therefore reference the field values in the working record of a given table<br />

reference using either the JSRecord object returned by its record property or its field<br />

references. The field references provide a convenient way to access table fields that is<br />

similar to how you reference table fields in ABL. The record property provides an<br />

alternative way to access table fields, especially one that has the same name as a<br />

property or method of a JSDO that you can invoke from a table reference.<br />

For example, the following code fragment shows two different ways to access the<br />

CustNum field of a record added to a customer temp-table provided by a resource<br />

ProDataSet:<br />

var dataSet = new Progress.data.JSDO( 'CustomerOrderDS' );<br />

dataSet.customer.add();<br />

alert(dataSet.customer.record.data.CustNum);<br />

alert(dataSet.customer.CustNum);<br />

254 <strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!