Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Hi,

Sorry but, what do you you mean by "how to reproduce it step by step"?

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

Map objects to list

Hi Lars,

I mean how to invoke this service in your app, where to find it.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

The navbar button with the star icon

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Service is invoked on load

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

Map objects to list

Hi Lars,

I cannot reproduce the issue, but I see this error in console (F12):preUncaught Error: The table 'favSongs' does not exist/pre
Please make sure this table exists and try again. Let us know about the result.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

I'm sorry, I forgot about the steps to create and populate the LSV-table in a new browser.

Steps:

  • Click on "Just Browsing" Button on start screen
  • Click on any item in the List to enter the details page(LSV table favSongs is created)
  • In the details page, click on the button with the star icon in the top right(populates the table)
  • Click on the middle button with the star icon in the nav bar
Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Map objects to list

Hi Lars,

I have a problem with 2nd step.

So after click on "Just Browsing" i see following screen:

http://prntscr.com/4si79b/direct

Regards.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Huh? Well that is weird... That is just a regular list service invoking on load with the appery.io backend service. On my devices, browsers and the appery test app, it looks like this:

Image

I really appreciate your effort guys! Thanks!

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

Map objects to list

HI Lars,

This time i've been able to get this list.

So here is result:

http://prntscr.com/4skd64/direct

So that means you did not populate this LSV.

Use following code instead of yours to see what in your "favSongs" lsv:

pre

Code: Select all

         //Note: you need replace "yourLSV" with LSV that's stores your array. 
         var responseData = JSON.parse(localStorage.getItem("favSongs")); 
         console.log("responseData = " + localStorage.getItem("favSongs")); 

/pre

Regards.

Lars Soligard
Posts: 0
Joined: Tue Sep 16, 2014 5:31 pm

Map objects to list

Hi,

Again, thank you for the response. It didn't work, but I think I left out something important in the past replies. I mentioned in my first post that when I call my localStorageDB, objects are returned. More specific: results are returned as arrays of object literals. First of all I need to initialise the localStorage db, second I need to query the db. That is probably why null was returned earlier. The code looks like this and I have included it in "genericService1JS":

var lib = new localStorageDB("fav", localStorage); //name of "db"
var q = lib.query("favSongs"); //name of "table"

In the Generic Service I've added "ID", "songTitle" and "musicalTitle" as response parameters.

  1. When I invoke the service parsing "q":
    var lib = new localStorageDB("fav", localStorage);
    var q = lib.query("favSongs");

    Code: Select all

     var p = JSON.parse(q); 
     var responseData = p; 
    
     console.log("ResponseData: "+p); 

...I get: "SyntaxError: Unexpected token o".

  1. When I invoke the service stringifying "q":

    Code: Select all

     ... 
     var s = JSON.stringify(q); 
     var responseData = s; 
    
     console.log("ResponseData: "+s);   

... I get: "ResponseData: [{"ID":1,"code":1412183756865,"songTitle":"Empty Chairs at Empty Tables","musicalTitle":"Les Misérables"},{"ID":2,"code":1412183764562,"songTitle":"Bring Him Home","musicalTitle":"Les Misérables"}]"

I have tried to map the response to a list but the list is empty:

Image

I hope this finally provides you with some good information about my project/problems.

Return to “Issues”