Forum Post: RE: Sending array objects in JSDO back to OpenEdge Rest Server

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

egarcia

Guest
Hello, Just some suggestions. For your approach mentioned in 1. You can call the JSDO API directly by using the "jsdo" handle from the JSDO Service: Example: MobilityDemoService_dsCustomer_JSDO.jsdo.sort(["CustNum"]); with the JSDO reference, you can call an INVOKE method in the Business by just using the name of the method. MobilityDemoService_dsCustomer_JSDO.jsdo.myMethod( Object-with-parameters-DataSet-or-TempTable ); You would need to transform the data that you showed above to use the format of DataSet or a Temp-Table. Alternatively, you can just send the JSON object as a string and then process it in the backend using the JSON API in the ABL. The advantage of using the object with parameters is that the processing of the multiple records in the array then would be handled by the ABL instead of you having to parse it with the JSON API. For your approach mentioned in 2. Using the JSDO reference, you can call the add() method. MobilityDemoService_dsCustomer_JSDO.jsdo.myMethod( object-with-fields ); Then call saveChanges(): MobilityDemoService_dsCustomer_JSDO.jsdo.saveChanges(); Please notice that the invoke method and saveChanges() are by default asynchronous. You would need to define a call back to process the response from the server. If you are using OpenEdge 11.4, you can use the JSDO Submit service which will send a DataSet with all the new records. (It internally calls saveChanges().) An alternative to using the add() method is to use addRecords() to populate the JSDO memory with the values, however, this is a direct change and the records are not marked as new/modified so you would have to loop through them to modify them so that they are marked as modified. (Then you would call saveChanges() or the JSDO Submit service.) The following example uses addRecords(): oemobiledemo.progress.com/.../example006.html You can use the Web Inspector to look at the source code. I hope this helps.

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