Map crashes when adding markers from data source

I want to add points to the map from a table. My code looks like this, but when I do live preview on my phone I get an error upon opening the map.

Running on Android11.

Your issue is probably rooted in the fact that your row ID should be a unique string of text and not a single digit.

1 Like

I tried renaming the int to string but its still crashing

The data table looks like this:

I’ve had similar problems populating a map from a datasource call (google sheets). What I found is that the data source blocks return the coordinates as STRINGs and adds quotation marks, even though the data is stored as a number. If the addMarker block is pass a values of “123” instead of 123, it will produce errors similar to your image. My solution is to convert the data source return values to numbers by adding zero.

See if that helps

That was one step forward and two steps back.
By adding 0, the map doesnt crash. but the location is in actual 0,0 location.
Ive also tried setting the lat/long as floats with 3 decimals, but then the map crashes again.
Is there no debug console or log anywhere I can look at?

I just discovered about an hour ago that the block “…with…decimal places” also converts number to strings. ARGH!!!

Another technique I have used to get around problematic Thunkable data typing is to store the value in a variable So the process becomes:

  1. Set local variable = data source values
  2. set local variable = local variable + 0
  3. Pass local variable into block

Since this is a data type issue, I would recommend that, for debugging, set the text property of a label to the variable and see if the quotation marks are present (or if the data source actually returned the value you were expecting). This can save a lot of time (and crashes).

Here is an example of a block I use for debugging

Good luck!

1 Like

If I assign longitude to a variable, the lable displays “undefined” in the app. (1)
But in (2) I can get the value of latitude straight from the data source.
Am I not initializing the variable correctly?

The problem appears to be with retrieving data from outlet_locations, not with the map. When a value says undefined, that the variable has not been set, or is some sort of unexpected value.

What type of data source is outlet_locations? The value of 1 (or “1”) is not necessarily the row number in the sheet. I THINK the row number can be used with google sheets, but I haven’t tried airtable or local DB for a long time.

1 Like