jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Mapping a collection or array

The code below shows an xml response. Here there are multiple Stationery and each Stationery has multiple stores. But when the response is automatically created from the request, there is only one Stationery and one store marked as array. But I need to map details of each store in that array to widgets. I also need to display each store in a map using the latitude and longitude of each store using markers. How is that possible?

pre
<Search>
<Stationery>
<StationeryId>2041<&#47;StationeryId>
<Store>
<StoreId>002<&#47;StoreId>
<StoreName>New Stationeries<&#47;StoreName>
<StoreAddress>5A, 13th avenue, Newyork<&#47;StoreAddress>
<StorePhone>1245889<&#47;StorePhone>
<StoreLatitude>10&#46;03<&#47;StoreLatitude>
<StoreLongitude>76&#46;30<&#47;StoreLongitude>
<&#47;Store>
<Store>
<StoreId>003<&#47;StoreId>
<StoreName>Lords Stationeries<&#47;StoreName>
<StoreAddress>7B, 78th avenue, Florida<&#47;StoreAddress>
<StorePhone>1457896<&#47;StorePhone>
<StoreURL&#47;>
<StoreLatitude>9&#46;94<&#47;StoreLatitude>
<StoreLongitude>76&#46;35<&#47;StoreLongitude>
<&#47;Store>
<&#47;Stationery>
<Stationery>
<StationeryId>2100<&#47;StationeryId>
<&#47;Stationery>
<&#47;Search>
/pre

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

Mapping a collection or array

Hi Jyotsna

Could you please clarify, do you get a normal mapping result, but one element only? From the above code we see that StationeryId=2100 doesn't contain Store. All the Response result must have the same structure.

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Mapping a collection or array

I am sorry Katya, I missed that. But my primary concern is, I need to map the 2 stores of stationeryId=2041 on to a map using 2 markers. But the issue is, as the response shows only one store as an array, I can't display two stores on to a map using markers.

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

Mapping a collection or array

Hi Jyotsna,

Could you please show us a screenshot of your mapping?

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Mapping a collection or array

Hi Katya.
This is the screenshot.

Image

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

Mapping a collection or array

Hello!
1) As the Store is an array you have to map it as array http://docs.appery.io/documentation/u...
2) As on the map suppose to be one marker you can't map array Store to the marker, so you need to add markers using JS. This should help http://docs.appery.io/tutorials/addin...
http://docs.appery.io/tutorials/addin...

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Mapping a collection or array

This above screenshot has restaurant instead of stationery. There are multiple restaurants and each restaurant has multiple stores. But as you can see, there is only 1 restaurant and 1 store. How will I be able to map multiple stores to my map or marker?

jyotsna s
Posts: 0
Joined: Tue Oct 01, 2013 10:28 am

Mapping a collection or array

Thnks marina. I will check this.

Return to “Issues”