[Solved] How can I identify which map marker was clicked?

Hello, i’ve been trying to make an app that sends you to another page when you click on a marker. I also need to know in which row of my airtable the marker was. I’ve been looking a lot in the community but i still can’t seem to get it working


Already thanks to all the support!

Have you verified that the “latitude” and “longitude” values of the green event block exactly match values in your Airtable column? Have you assigned labels to each of the four values (two lat/lon pairs) you’re testing to make sure you’re seeing what you expect them to be?

Your blocks look really convoluted to me. Why not just use “find first occurrence of” block in the List drawer to see if the “list of values” from Airtable contains the lat/lon value you are getting from the event block? If the result of the “find first occurrence” block is 0, it isn’t found. If it’s a number greater than 0 then it refers to the row it was found in.

If “longitude found in row #” equals “latitude found in row #” then you know the same row had matching longitude and latitude values.

2 Likes

Thank you so much! u fixed one of my problems i was trying to fix for 5 hours in 2 minutes.

I have 1 other problem how would i make it output a variable saying in which row it was found?

Greetings,Freek Apeldoorn

2 Likes

You can assign the “longitude found in row #” variable to a label’s text to display it to the user.

2 Likes

Ahhhh, thank you so much!

1 Like

Hello,

When i click on a marker my program is supposed to save from which row it was and set the row in which it was found to a variable. But when i get to another page and i try to use the variable again it seems that it has reset to 0. So i’m not sure what to do with this!

Greetings,
Freek Apeldoorn

Can you post a screenshot of the blocks on the Winkel info screen?

How have you verified that app variable found in row # is a non-zero integer before you change screens? And after you change screens?

I’ve been using this as a simple test!

And i have no idea what that even is :sweat_smile:. So i’m guessing that is the problem!
Knipsel
`

Stored variables are a special situation. You have to check to see if they are null when the screen opens and if so, set them to an initial value (e.g. 0). I don’t know why this is and it’s something Thunkable should just do in the background.

Let’s remove the stored variable and see if that’s the problem. What happens when you set a label’s text to app variable found in row # in the original screen and in the Winkel info screen? What are the two values that you see?

Hey, sadly enough it still says 0 when i test it!

I don’t know what that means. For me to help you, I need to know the answer to my specific question. Is it showing zero on both screens? Have you removed the stored variable blocks?

Can you share the project link with me? It’s hard to troubleshoot without seeing what you’re seeing.

If your app variable found in row # equals zero then it means that the lat/lon value was not found in your database when you used the “find first occurrence” block. So you need to figure out why those values are not matching.

I just noticed a problem with your blocks. You are finding the first occurrence of app variable ThisLong for both longitude and latitude.

1 Like

Ahhhhhhhh, thank you sooo much! not just for this fix but for all of them! ur a lifesaver.

So simple but so destructive :joy:

Well thank you so much!

1 Like

Hey,
So i tought i got it working. But it’s not now so i really don’t understand why it can’t find the cordinate’s! I really tried everything i tought might be the error.
Knipsel

1 Like

What lat/lon values are you getting when you run the app?

Can you share the project link?

1 Like

Property names are case-sensitive. Longitude needs to be lowercase. See the “On User Location Change” section in the documentation.

2 Likes

Hmm… sadly enough this still hasn’t fixed the issue. It did make it output the cordinates but it seems like it can’t find the cordinates in the airtable and i really don’t understand why it doesn’t find them…

https://x.thunkable.com/copy/e50298e1087f02a8f588d92f36880441
Knipsel

1 Like

This is entirely dependent on the level of accuracy of the comparison.

For example, if the onMarkerPress gives you a Lat value of 51.284080201 and your Airtable has 51.28408020 (without the last 1) then there will be No Match.

Best is to show the numbers obtained from the onMarkerPress and check if they really are available in your table.

Ohhh, this might explain it. Because it looks like my output is more specific than my airtable. But how would i make airtable more exact or onmarkerpress less acurate?

1 Like

Use the round block
image
to make the onMarkerPress less accurate. Round it to the same number of decimals of what you have in your table.

1 Like