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

Status
Not open for further replies.
S

spserna2

Guest
Thanks Richardo and egarcia, I have followed the 2nd option since it will be easier for OpenEdge developer. I trying to wrap my JSDO call in a Generic Service, and MCBDriversService_BECheckQuestions_JSDO is the JSON catalogue I imported from OpenEdge. $t.SubmitChecklist = $t.createClass( null , { init: function (requestOptions) { this .__requestOptions = $.extend({}, requestOptions); }, process: function (settings) { if ( this .__requestOptions.echo) { settings.success( this .__requestOptions.echo); } else { console.log('This will start the checklist submission process'); var taskNo = settings.data.taskNo; var longitude = settings.data.longitude; var latitude = settings.data.latitude; var dateTime = new Date(settings.data.dateTime); var questionCount = parseInt(settings.data.questionCount); console.log('Setting values are: ' + taskNo + '_' + questionCount + '_' + longitude + '_' + latitude + '_' + dateTime); var allAnswers = []; var questionName = 'question'; var answerName = 'answer'; var svc_jsdo = MCBDriversService_BECheckQuestions_JSDO.jsdo; console.log(svc_jsdo); for ( var i = 0; i questionCount; i++) { var questionData = JSON.parse(localStorage.getItem(questionName + i)); var answerData = JSON.parse(localStorage.getItem(answerName + i)); questionData.ResponseValue = answerData.ResponseValue; questionData.IssueSeverity = answerData.IssueSeverity; questionData.Comments = answerData.Comments; questionData.PhotoImage = answerData.PhotoImage1; questionData.Longitude = longitude; questionData.Latitude = latitude; questionData.ConfDateTime = dateTime; console.log(questionData); svc_jsdo.add(questionData); } /* Before sending the request, save it away so we execute * only the function for this DataSource */ var beforeSaveChangesFn = function (jsdo, request) { jsdo.unsubscribe('beforeSaveChanges', beforeSaveChangesFn ); settings.request = request; }; var afterSaveChangesFn = function (jsdo, success, request) { /* If not for the same request saved away on the before * saveChanges fn , just return */ if (request != settings.request) return ; /* Unsubscribe so this fn doesn't execute for some other * Tiggr.DataSource event */ jsdo.unsubscribe('afterSaveChanges', afterSaveChangesFn ); var cStatus = 'success'; if (success || (request.xhr.status = 200 && request.xhr.status 300)) { settings.success(request.response); } else { var cError = normalizeError(request); settings.error(request.xhr, cError); cStatus = cError; } settings.complete(request.xhr, cStatus); }; svc_jsdo.subscribe('beforeSaveChanges', beforeSaveChangesFn); svc_jsdo.subscribe('afterSaveChanges', afterSaveChangesFn); svc_jsdo.saveChanges(); } } }); I had some error message related to ProDataSource. {"_retVal":"ProDataSource extent value must be a valid DataSource Handle.","_errors":[{"_errorMsg":"ERROR condition: The Server application has returned an error. (7243) (7211)","_errorNum":0}]} I google up a bit but there is no documentation describing the error, anyone know what is this error about, for references, I exported my Network analysis information in .har file, https://drive.google.com/file/d/0B3Nnv9mByE-pbHc1a3FRd09EcUE/view?usp=sharing You could use https://toolbox.googleapps.com/apps/har_analyzer/ to analyze the data traffic with the server.

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