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.

addRecords( ) method<br />

key-fields<br />

An object with a list of key fields to use to check for duplicate records. For<br />

example, when merging with a ProDataSet that has eCustomer and eOrder table<br />

references, you might use the following object:<br />

{<br />

}<br />

eCustomer: [ "CustNum" ],<br />

eOrder: [ "CustNum", "Ordernum" ]<br />

When merging with a single table reference, you might use the following array<br />

object:<br />

[ "CustNum", "Ordernum" ]<br />

A typical use for addRecords( ) is to merge additional data returned by an invocation<br />

method without having to re-load local storage with all the data from the fill( )<br />

method.<br />

For example, given a JSDO, dataset, that you fill with available records from the<br />

eCustomer and eOrder temp-tables, you might retrieve a new eOrder record as the<br />

result of a getNewOrder( ) invocation method on the JSDO and add the new record<br />

to JSDO local storage as follows:<br />

var dataset = progress.data.JSDO( "dsCustomerOrder" );<br />

dataset.fill(); // Loads the ProDataSet with all available records<br />

// Adds a new eOrder record restrieved from the service<br />

var request = dataset.getNewOrder(null,false);<br />

dataset.eOrder.addRecords( request.response, progress.data.JSDO.MODE_APPEND,<br />

[ "CustNum", "Ordernum" ],<br />

);<br />

This code fragment adds the eOrder record for an existing eCustomer record specified<br />

by the CustNum property and a new order number specified by the Ordernum property<br />

of the single record object returned in result.dsCustomerOrder.eOrder[0].<br />

See also: fill( ) method, invocation method<br />

182 <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!