Carlota
Posts: 0
Joined: Mon Aug 04, 2014 8:10 am

Newbuilder problems: mapping database query service to JS

Hi Appery.io support team!
I have found a new problem with one of the features of my project (originally built in the oldbuilder) that is not working in the newbuilder.

On PageShow of one of my app screens, I send a query to appery.io database, but instead of mapping it directly to a mobileitemlist; I map it to a JS that stores new values in a local cache (I called it SynchJS). Then, upon Service Complete event, I invoke a Generic service that reads the whole local cache and performs mapping against mobileitemlist. This way, no matter the device has connectivity or not; I can show results on the screen.

In oldbuilder, SynchJS stores in localCache all new entries obtained from Appery database; so if n new items are obtained from Appery database, the JS is executed 10 times.
However in newbuilder, SynchJS just stores the first entry obtained from Appery database. Even though n new items are available on Appery database, the JS is executed just once.

I enclose two screenshots, first one from the oldbuilder mapping:
Image

...and second one from the newbuildermapping:
Image

Any suggestion, workaround... is appreciated
Thank you in advance!
Carlota F:

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Newbuilder problems: mapping database query service to JS

Hi Carlota,

Could you please tell in detail what doesn't work? Is it your custom code? Are there any console errors?

Carlota
Posts: 0
Joined: Mon Aug 04, 2014 8:10 am

Newbuilder problems: mapping database query service to JS

Kateryna
SynchJS stores in localCache new entries obtained from Appery database;
In oldbuilder, if n new items are obtained from Appery database, SynchJS is executed n times.
However in newbuilder, even though n new items are available on Appery database, the JS is executed just once.
This means when the app is upgraded to the new builder, and assuming n new entries are available in Apperyio database; only one is stored in local Cache.
Thank you in advance!
Carlota F:

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

Newbuilder problems: mapping database query service to JS

Hi Carlota,

In new editor it works in following way:

  1. Open "Storage and models".

  2. Add new model with type "Array". http://prntscr.com/4uey7v/direct

  3. Add storage with type model from 2nd step. http://prntscr.com/4ueyq8/direct

  4. Navigate to "success" mapping.

  5. Make link from "$" to storage from 3rd step: http://prntscr.com/4ueyzi/direct

  6. This time you can click on "JS" for link from 5th step and add goal JS code you need. And this code will execute every item from response.

    That's all.

    Regards.

Carlota
Posts: 0
Joined: Mon Aug 04, 2014 8:10 am

Newbuilder problems: mapping database query service to JS

Thank you for your fast response, Yurii! It works!

It was an extra task as I almost completed my project in the oldbuilder, but now the implementation is 10 times shorter!

Carlota F:

Return to “Issues”