Forum Post: RE: _id

  • Thread starter Thread starter egarcia
  • Start date Start date
Status
Not open for further replies.
E

egarcia

Guest
The READ operation updates the records in the JSDO memory. The INVOKE operation returns the TT but its data is not in the JSDO. You can work with the JavaScript object returned by the INVOKE directly. Alternatively, you can use the addRecords() method. Example: jsdo.eCustomer.addRecords(request.response.dsCustomer, progress.data.JSDO.MODE_EMPTY); You can see a sample program using addRecords() at the following URL: http://oemobiledemo.progress.com/jsdo/example006.html Here is the source code: !DOCTYPE html html head script src="http://oemobiledemo.progress.com/jsdo/progress.session.js" /script script src="http://oemobiledemo.progress.com/jsdo/progress.js" /script script var serviceURI = "http://oemobiledemo.progress.com/MobilityDemoService"; var catalogURI = "http://oemobiledemo.progress.com/MobilityDemoService/static/mobile/MobilityDemoService.json"; session = new progress.data.Session(); session.login(serviceURI, "", ""); session.addCatalog(catalogURI); jsdo = new progress.data.JSDO({ name: 'dsCustomer' }); //jsdo.subscribe('AfterFill', onAfterFillCustomers, this); //jsdo.fill(); jsdo.subscribe('AfterInvoke', 'CustomRead', onAfterInvokeCustomRead, this); jsdo.CustomRead({}); function onAfterFillCustomers(jsdo, success, request) { jsdo.eCustomer.foreach(function(customer) { console.log(jsdo.eCustomer.getId() + " " + customer.data._id); document.write(customer.data.CustNum + ' ' + customer.data.Name + ' br '); }); } function onAfterInvokeCustomRead(jsdo, success, request) { jsdo.eCustomer.addRecords(request.response.dsCustomer, progress.data.JSDO.MODE_EMPTY); jsdo.eCustomer.foreach(function(customer) { console.log(jsdo.eCustomer.getId() + " " + customer.data._id); document.write(customer.data.CustNum + ' ' + customer.data.Name + ' br '); }); } /script /head body /body /html I hope this helps.

Continue reading...
 
Status
Not open for further replies.
Back
Top