hallworthdesign
Posts: 0
Joined: Wed Mar 12, 2014 12:47 pm

Struggling with Fusion table response data

I'm struggling to work with the response data and mapping it to labels.
I don't know how to get the service response to pick up the data in the array and show it in different places. I just get all the data shown in one place.

I have set up a REST service to pull data from a Fusion table.
The test request works and returns data fine.

Data response is like this
code
{
"kind": "fusiontables#sqlresponse",
"columns": [
"rowid",
"name",
"description"
],
"rows": [
[
"1001",
"Harlequin Vintage",
"My desc"
],
[
"1002",
"Wolf & Gypsy Vintage",
""
],
[
"1003",
"Artifice Vintage Furniture & Interiors",
""
]
]
}
/code

I clicked 'Automatically Create Service Response' to set the response parameters like below
Image

I map the service to the list components labels

Image

Which shows this
Image

I want to split the response data and show them under different labels.
All I get is
I've worked through the tutorials but can;t spot a similar scenario to work from.

Help!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Struggling with Fusion table response data

Hello!

As this is array, you can't map each value to a separate element. But you can add Grid with one label and do mapping, see the screenshot.
Image
Another way is to fill in Label value with JS.

hallworthdesign
Posts: 0
Joined: Wed Mar 12, 2014 12:47 pm

Struggling with Fusion table response data

thanks for your reply Maryna, I've tried that but it just seems too give me the same result as when using the list item with labels or am I missing something?
Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Struggling with Fusion table response data

Please look at the screenshot I posted and do exactly the same mapping.

hallworthdesign
Posts: 0
Joined: Wed Mar 12, 2014 12:47 pm

Struggling with Fusion table response data

Apologies - I didn't put the grid in a list item and map it properly. I now have my data appearing as separate items - repeating the label for each item.

I don't want to show rowid in a label but as I've requested it in the select statement, it's being displayed. How can I intercept the data response values in javascript so I can format it? Sorry to be a dunce, but I'm trying to understand how this all fits together

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

Struggling with Fusion table response data

Hello,

You can handle data on mapping with adding JS:
http://docs.appery.io/documentation/r...

hallworthdesign
Posts: 0
Joined: Wed Mar 12, 2014 12:47 pm

Struggling with Fusion table response data

Ok thanks Nikita, I hadn't found that page previously

hallworthdesign
Posts: 0
Joined: Wed Mar 12, 2014 12:47 pm

Struggling with Fusion table response data

Finally got this working after 3 days bashing of head.
Hope this helps someone.

I have a single mobileListItem that contains 3 labels.
Labels are populated with data returned from fusion service response.

Here's the response mapping - javascript populates the 3 labels using the 'value' array it is passed.

Image

Javascript is this
code
$('[dsid=rowid]', element).text(value[0]);
$('[dsid=placeName]', element).text(value[1]);
$('[dsid=placeDescription]', element).text(value[2]);
/code

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Struggling with Fusion table response data

Thank you for sharing!

Return to “Issues”