Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Generic Service Results not Populating List

Hi Dave,

In the following line of code you return string, but pure "object/array" needed.

pre

settings.success(JSON.stringify(ourFinalArray));

/pre

Correct code will be:

pre

settings.success(ourFinalArray);

/pre

Also, don't forget to set correct response parameters. You can do it automatically if you have JSON response from "Test" tab of your service.

Regards.

DaveVockell
Posts: 0
Joined: Thu Dec 12, 2013 10:26 am

Generic Service Results not Populating List

Making that change throws this error:

Uncaught Error: Attempt to access Array by property name : 'type'mapping-impl.js:325 window.mep.getmapping-impl.js:343 window.mep.getmapping-impl.js:310 window.mep.getmapping-impl.js:82 window.entry.Entry.getValuemapping-impl.js:196 window.mapping_unit.MappingUnit.processMappingsmapping-impl.js:127 window.mapping_unit.MappingUnit.processmapping-impl.js:10 processMappingActiongrabdata.js:135 window.listo.Apperyio.datasources.listo.Apperyio.DataSource.onSuccessappery.js:359 Apperyio.DataSource.$a.createClass.__successHandlerjquery-2.1.1.js:513 proxylistgrab.js:36 (anonymous function)

If I switch it back, the error goes away, but still no table built.

In this example, it has the JSON.stringify modifier like I had....

http://devcenter.appery.io/tutorials/...

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Generic Service Results not Populating List

Hi Dave

it seems you have wrong response parameters.

Please show us your response JSON structure and screen shot from the server response tab.

Regards.

DaveVockell
Posts: 0
Joined: Thu Dec 12, 2013 10:26 am

Generic Service Results not Populating List

This is the response:

Image

Here is what I can see...

If I add in a console.log line as a I generate the response

for (i = 0; i < len; i++) { // for each row
ourFinalArray.push(results.rows.item(i)); // pushing row object to an array
console.log(results.rows.item(i));
}

then it shows what looks like the correct data object:

Image

If I remove any data mapping, no error is thrown, but it does not build an empty table. If I map one of the elements ("short") , it throws the error:

Uncaught Error: Attempt to access Array by property name : 'short'

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Generic Service Results not Populating List

Dave,

Nope, your response parameters not good...

You have an pure JS array as response.. But in your parameters you specify only one item.

See details about correct response type for your case: http://prntscr.com/5jyuk6/direct

Regards.

DaveVockell
Posts: 0
Joined: Thu Dec 12, 2013 10:26 am

Generic Service Results not Populating List

PERFECTO.

Thanks.

DaveVockell
Posts: 0
Joined: Thu Dec 12, 2013 10:26 am

Generic Service Results not Populating List

\""desc\"":\""0\""}]'); settings.success('[{\""id\"":\""\""

Return to “Issues”