Constantinos Efthymiou
Posts: 0
Joined: Fri May 23, 2014 11:21 am

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi. I would appreciate any help/guidance on two issues:
1) Created a collection in appery database for wine data (variety, producer, region, photo etc.). How should I add the field for photos, and where should I upload/store/retrieve them?
2) Tutorial "Building a clickable list app with HTML5 local storage" using as a data source the above database. Everything works fine, but the _id on the details page. I get "undefined" where the data should be.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hello Constantinos,

You can store photo in a custom collection as base64 string. (http://devcenter.appery.io/tutorials/...)
or upload image files to "files" collection and use id of photo in your "wine" collection. Here is more about file collection: http://devcenter.appery.io/documentat...
Not sure I understand your second question. Provide more info, screenshots with service mapping and settings, Does this service return correct value in test tab: http://devcenter.appery.io/documentat... ?

Constantinos Efthymiou
Posts: 0
Joined: Fri May 23, 2014 11:21 am

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi thanks for helping.
1) I will read the links and try the options out. Thanks.
2) Screenshots:
The list page
Image
The details page with the "undefined"
Image
One list and one read service that return results when tested
Image
Image
Mappings for request, response and invoking
Image
Image
Image

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

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Constantinos,

You receive a text 'undefined' for the records with empty Database text field. To avoid this, add the following JS to a component mapping:prereturn value ? value : "";/pre

Constantinos Efthymiou
Posts: 0
Joined: Fri May 23, 2014 11:21 am

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Katya, thanks for the reply,

I have added the JS to all mappings, so that when a field is empty, it won't return 'undefined' but an empty string.

However, that is not the problem. The test database I have setup has 5 records and all fields have a value. The problem is, no value is returned!!! Please have a look at the screenshots above. There must be some error in the services setup or mappings, but I cannot find it. Please help!

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

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Constantinos,

Please post your public app link and the exact steps to reproduce the issue.

Constantinos Efthymiou
Posts: 0
Joined: Fri May 23, 2014 11:21 am

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Katya,

Public app link:
http://appery.io/app/mobile-frame?src...

Click "Enter the Wine Cellar" and then click any of the wines listed. The next screen should return the data of the wineID clicked on the previous screen.

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

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Constantinos.

There is several errors in you app.

Main reason of these all errors is you have wrong data format in your read service. Read service should return an object instead of array like in your screeen shots.

So please follow these steps to get it work:

1 Invoke read service(for details page) on "page show" page instead of "page load".

2 Open your "vinodb_wines_read_service" service. Navigate to "test" tab and put in "_id" field "535dfcabe4b0887b119de813". Then click "Test". When request appears - click on "Automaticaly Create Service Response". http://prntscr.com/3n9nxr/direct

3 Open "WineDetails" page and navigate to the "Read datasource" edit mapping. Create mapping from "wineID" LSV to the "_id" request parameter. http://prntscr.com/3n9odw/direct

4 Open response tab in datasource mapping editing and create mapping you need.(your previous mapping was incorrect cause of you had incorrect data in response.) http://prntscr.com/3n9qtn/direct

5 Open "WineCellar" page. And open "Events" bottom tab. Add click event handler on "mobilelistitem_2" component with type "Set LSV". Enter LSV name "wineID" and bind it to the "wineID" component. And arrange this event before click event with action "navigate to page" http://prntscr.com/3n9pbd/direct

That's all.

Regards.

Constantinos Efthymiou
Posts: 0
Joined: Fri May 23, 2014 11:21 am

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hi Yurii, thanks for the reply,

I implemented all the steps but still I get undefined.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Photos in a collection and "Building a clickable list app with HTML5 local storage" problem

Hello Constantinos,

You should map local storage variable "wineID" to "_id" request parameter of service "vinodb_wines_read_service" instead of local storage variable "id"

Return to “Issues”