Embedded map view (Problem with multiple markers and MAP function)

Hi Guys,

I’m trying to load multiple markers on Embedded map view from a Data variable. My data looks like following.

[
    {
        "id": 1,
        "title": "Coffee Bean & Tea Leaf",
        "address": "Expressway, Phase 7 Bahria Town, Rawalpindi, Islamabad Capital Territory 46000, Pakistan",
        "website": "http://coffeebean.pk/",
        "phone": "+92518355507",
        "status": null,
        "lat": "33.5155168",
        "lng": "73.0857128",
        "url": null,
        "published_at": "2021-09-10T15:33:20.436Z",
        "created_at": "2021-09-10T15:31:49.793Z",
        "updated_at": "2021-09-10T15:33:20.464Z"
    },
    {
        "id": 2,
        "title": "Coffee Planet",
        "address": "Opp. DHA Signal، Zenith Plaza، Bahria Expy, Phase 8 Sector F Bahria Town, Rawalpindi, Islamabad Capital Territory, Pakistan",
        "website": "https://coffeeplanet.com/",
        "phone": "+92515400283",
        "status": null,
        "lat": "33.5206253",
        "lng": "73.1029607",
        "url": null,
        "published_at": "2021-09-10T15:45:19.226Z",
        "created_at": "2021-09-10T15:45:17.212Z",
        "updated_at": "2021-09-10T16:06:15.712Z"
    }
]

When I add a formula with static info like following, it works and I can see both the markers on the map. (Even with red error)

But if I try to load the dynamic data variable that is binded with Rest API the app crashes and I get following error in the debugger.

TypeError: Cannot read property 'map' of null This error is located at: in Component in Unknown in A in RCTView in RCTScrollView in N in KeyboardAwareN in Component in Unknown in A in c in y in A in Unknown in Unknown in Unknown in Unknown in RCTView in RCTView in RCTView in ForwardRef in RCTView in P in PanGestureHandler in Unknown in RCTView in P in RCTView in G in Unknown in RCTView in Unknown in RCTView in Unknown in R in h in Unknown in RCTView in w in Unknown in y in Unknown in Unknown in Unknown in Unknown in RCTView in x in RCTView in RCTView in V in RCTView in c in RCTView in Unknown in w in Unknown in C in Unknown in Unknown in Unknown in Unknown in RCTView in RCTView in RCTView in ForwardRef in RCTView in P in PanGestureHandler in Unknown in RCTView in P in RCTView in G in Unknown in RCTView in Unknown in RCTView in Unknown in R in h in Unknown in RCTView in w in Unknown in Unknown in b in A in ForwardRef in Unknown in Unknown in Unknown in Unknown in RCTView in RCTView in RCTView in ForwardRef in RCTView in P in PanGestureHandler in Unknown in RCTView in P in RCTView in G in Unknown in RCTView in Unknown in RCTView in Unknown in R in h in Unknown in RCTView in w in Unknown in H in RCTView in Unknown in ForwardRef in Unknown in ForwardRef in Unknown in A in c in c in RNCSafeAreaProvider in Unknown in Q in RCTView in Unknown in k in Root in RCTView in x

Please help, I’m out of ideas.

1 Like

Hey, could be that you are trying to evaluate the MAP formula for the data before it actually loads. I would create a helper page variable to hold the string, populate it with MAP on the data variable logic canvas after “Get collection” is successful, and then bind the markers to render to the page variable. Would that solve the issue?