Page 1 of 1

Mapping a collection or array

Posted: Thu Oct 03, 2013 5:32 am
by jyotsna s

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


Mapping a collection or array

Posted: Thu Oct 03, 2013 7:48 am
by Kateryna Grynko

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.


Mapping a collection or array

Posted: Thu Oct 03, 2013 11:04 am
by jyotsna s

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.


Mapping a collection or array

Posted: Thu Oct 03, 2013 12:22 pm
by Kateryna Grynko

Hi Jyotsna,

Could you please show us a screenshot of your mapping?


Mapping a collection or array

Posted: Thu Oct 03, 2013 1:05 pm
by jyotsna s

Hi Katya.
This is the screenshot.

Image


Mapping a collection or array

Posted: Thu Oct 03, 2013 4:08 pm
by Maryna Brodina

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...


Mapping a collection or array

Posted: Fri Oct 04, 2013 4:11 am
by jyotsna s

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?


Mapping a collection or array

Posted: Fri Oct 04, 2013 12:50 pm
by jyotsna s

Thnks marina. I will check this.