OpenEdge Development: Mobile Applications - Product ...
OpenEdge Development: Mobile Applications - Product ...
OpenEdge Development: Mobile Applications - Product ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
JSDO overview<br />
If a method leaves a working record, you can reference the field values of the record<br />
object using field reference properties on the table reference, as described in the<br />
previous section. You can also use the record property on the table reference to return<br />
a reference to a JSRecord object for the working record that you can reference directly<br />
or store separately to access the record object later. A JSRecord object provides a<br />
data property that references a separate JavaScript object with the actual field<br />
reference properties for the record. Also as a convenience, if the JSDO supports only<br />
a single temp-table, you can access the record property for the working record directly<br />
on the JSDO reference itself.<br />
So, using the previous example with ttCustomer, where it is the only temp-table in<br />
local storage, you can access the Name field using a JSRecord object reference in the<br />
following ways:<br />
var custName = dsOrderEntry.record.data.Name; // Single temp-table only<br />
var custName = dsOrderEntry.ttCustomer.record.data.Name;<br />
var custRecord = dsOrderEntry.ttCustomer.record; // Stored for later reference<br />
var custName = custRecord.data.Name;<br />
Once stored, an existing record object remains available using the stored JSRecord<br />
reference even when it is no longer the working record for the temp-table. Note that<br />
using the data property to write a value to a field is not recommended, because the<br />
record object is not marked as changed in local storage and won’t be updated on the<br />
AppServer. To update a field value on a JSRecord object reference so the change is<br />
made on the AppServer, call the assign( ) method directly on the JSRecord<br />
reference.<br />
Note: One reason to use the record.data property on a table reference to read a<br />
field value is when the field has the same name as a JSDO method that you<br />
can call on a table reference.<br />
Caution: Because the record object is not marked as changed in local storage, never<br />
use the data property on a JSRecord reference to update the value of a field.<br />
The change will never be posted to AppServer. Use the data property to read<br />
the field value only.<br />
Record IDs<br />
One difference between the JavaScript record objects in JSDO local storage and the<br />
temp-table records that they represent is that each record object contains a record ID.<br />
This is an internal field that uniquely identifies the record in JSDO local storage. This<br />
record ID has no relationship to the internal RECID and ROWID values maintained for the<br />
records of an <strong>OpenEdge</strong> database. Instead, this record ID is used by the client JSDO<br />
services built into the <strong>Mobile</strong> App Builder, and also by the progress.ui.UIHelper<br />
class, to map the record objects in JSDO local storage to the HTML elements of <strong>Mobile</strong><br />
Apps. Also, you can retrieve this record ID from any record object in local storage and<br />
store it for future reference in order to efficiently retrieve the record object, again, from<br />
local storage.<br />
<strong>OpenEdge</strong> ® <strong>Development</strong>: <strong>Mobile</strong> <strong>Applications</strong> 95