Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

Issue with Generic Service

Hi,
I am struggling with a Generic service that previously worked and that I built earlier this year.
I am loosing it in the condition where I put in: alert("script has been terminated");

Apparently the code does not go beyond
if (this.requestOptions.echo) {
settings.success(this.requestOptions.echo);
.....

Can you explain to me what this condition actually does? I am lost.
Thank you in advance.

Her is the code:

Appery.getOffline = Appery.createClass(null, {

init: function(requestOptions) {
this.__requestOptions = $.extend({}, requestOptions);
},

process: function(settings) {
if (this.requestOptions.echo) {
settings.success(this.requestOptions.echo);
alert("script has been terminated");
}
else {
// load JSON data from local storage
var cdata = localStorage.getItem("offline1");
var cdata3 = JSON.parse(cdata);

Code: Select all

   //This is how the content of the local storage "offline1) looks like 
   //[{"PipelineSegment":"30566-3","CompanyName":"TAQA North Ltd."},{"PipelineSegment":"30566-8","CompanyName":"TAQA North Ltd."},{"PipelineSegment":"37397-1","CompanyName":"Crescent Point Energy Corp."},{"PipelineSegment":"37397-4","CompanyName":"Crescent Point Energy Corp."},{"PipelineSegment":"44372-1","CompanyName":"Anterra Energy Inc."},{"PipelineSegment":"47836-1","CompanyName":"Ridgeback Resources Inc."},{"PipelineSegment":"49783-1","CompanyName":"Enerplus Corporation"}] 

   // pass the JSON to the service, for output mapping 
   settings.success(cdata3); 
 } 

 settings.complete('success'); 

}

});

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Issue with Generic Service

Hello Bernie,

Could you please clarify what exactly doesn't work?

If you want us to help you debug the app, please consider purchasing the Advisory Pack service: https://appery.io/services/#Advisory_.... This service includes app debugging as well as any other custom app help. If this particular issue turns out to be an Appery.io bug, we will credit back the hours spent on this issue and you will be able to use them toward another issue.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

Issue with Generic Service

Hi Serhii,

The problem is that I can parse a single object like {'name': 'joe',"age":"24"} to the mapping service of the Generic service,

but I can not parse something like [{"name": "joe","age":"24"},{"name":"Dan","age":"22"}] to the mapping service of the Generic service while mapping data$ to my list.

I put together a brief example based on your documentation on https://devcenter2.appery.io/document...
and shared it with support.

I had the exact same thing running a few weeks ago and I am puzzled why it is not working anymore.

I will shoot you an email as well.

Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

Issue with Generic Service

Never mind. I got it. Case solved.

I had my response parameters set wrong.

This is how they need to look like: Image

Return to “Issues”