Hi - I have spent hours reading others comments, watching You Tube videos but I’m stuck.
I have a map with icon markers driven from lat and long data from google sheets and all is working well. I can click on the markers and get a ‘callout’ - I click on this text and it takes me to my intended next screen - however to pull this data from this specific marker I need to call out (I think) a row id.
So far I cannot find ‘rowid’ as an option in any of the drag & drop functions - I tried following someone elses blocks but they call out row id and I don’t have that option. I tried using the hidden ID column from Sheets but this didn’t work either - I’m sure I’m missing a massive step somewhere and this seems like such a simple thing to want to do … I’m sure if I could get my head around this it would set me up to move forward so much quicker.
Could someone please help this beginner to progress - I’ll attach screen shots too to what I have. Thanks in advance
The row ID is an internal value generated by the data source. It is stored in a column called “ID” that can be selected from Get Value and List of Values data source blocks.
But you can also use an integer value as a row id to select a row.
Thank you for responding, I really appreciate it - I think I have done what you suggested - I set the app variable “DatabaseID” to List of values - sheet - ID
Do I need to get values instead
And do I initiate the app variable to null or 0? Sorry I’d try these things out but for some reason the thunkable app doesn’t want to let me in this afternoon.
The Get Value block will get a single value whereas the List of Values block gets the whole column and you’d need to extra a list item from it.
It mostly doesn’t matter if you leave a variable Initialize block empty. That’s what I generally do. That way, when you first Set the variable value, it auto-selects the variable type (string, list, number, etc.).
Thanks I’ll try some of this in the morning! Thank you for your help once again!
Ok @tatiang I used the get value to set the variable after creating a column called RowID in the source sheet but then have nothing to put in rowid at the end??
Then did this on the swimspotinfo screen - do I need to initialize and set the databaseobj variable like this - is this correct?
This is just one of the fields I am going to fill in on the swimspotinfo screen but if I can get one working I can just replicate for the others - currently I’m getting nothing (live on app on device). see clip below
Please re-read what I posted above about row ids. You do not create them in a data source. They already exist. You can either select them from the “in” drop-down menu in the
get value block or you just use a math or text block to manually set the row id as a number (1, 2, 3, etc.).
Hi @tatiang - I promise I read your stuff - but I’m encountering some differences - see brief vid I made to explain - it’s saved on gdrive. ThunkableProjectJD - 1699032686228.mp4 - Google Drive
I hope it makes sense to you and again THANK YOU SO MUCH! <3
Another issue is that this will not work properly to reference variables:
You’re telling Thunkable to set the value of the app variable with the name provided from the value of app variable Database ID. What you want instead is the
set app variable DatabaseID block at the top of the Variables drawer. Don’t use the
set app variable " " block at the bottom of the Variables drawer.
As for the video, let’s back up for a moment… which row are you trying to get data from? Because the row id value you enter will depend on that. Is it the first row? The last row? A row # based on a search result?
oooh thank you this has made such a difference changing that ‘set app variable’ from the right place in the drawer - now at least I’m getting the text ‘NickName’ in that box - so to answer your question the row I’m trying to get is the row related to the ‘map callout’ clicked on so essentially a row # based on a search result.
They click on a map marker, it opens a callout with ‘name & desc’ then they click on that specific marker callout text to take them to more info about that specific place…
I don’t have a lot of experience with the Map component. But the onCalloutPress event has a green
event block that is probably an object with various data property names. I had trouble finding info about it in the documentation. I did find an
event block for the onMarkerPress event that has the properties “latitude” and “longitude” so my assumption is that your event has the same properties.
So you would need to get those values and search your data source for the row containing them and then use that row number as the row id in your
get value block.
This is complicated stuff! Here’s what I’m referring to from the documentation:
This looks interesting I’ll give this a go tomorrow! Thanks again have a great weekend.
you can try my way. i create a function and return i value. With a loop, it will initialize i from 1 to the number of rows present in the table and use logic. If the logic is satisfied, it returns i as the cumulative number of that row. Then you just need to go to function and select the function to attach to the “Id” you are missing.
I use Google to translate, sorry for the inconvenience
Thank you for taking the time to put this together - I have something similar to display the correct names on the correct map callouts and this works wonderfully. However when I click on the call out it takes me to the screen correctly then all the boxes are blank…
So the map looks like this clip
showing the callout correctly at this location - but when i click on it - it goes here - clip below
This is also correct but no info in the boxes… The spreadsheet has all the info for each callout but I don’t know how to get it to pull in the information when you click on each specific callout.
I suggested a method above to achieve this. Have you tried that? You have to match the clicked location with the saved locations.
I have tried everything everyone has suggested - I will keep trying variations on a theme - at the moment I think I have taken a step backwards so will regroup back to where I was as I think I was getting close ha ha - it’s very frustrating as I’m sure I could make good progress once this hurdle is cleared. Thank you again for all the suggestions.
I think the issue with this method -
is that the map1-onmarker press (or callout press that I want) is only available on the Search Screen whereas the set Label1’s text is only available on the swimspotinfo screen so I can’t do this (or don’t know how)
Right, so you would have to store the latitude and longitude values in two variables (within the onMarkerPress block) and then reference the variables on the next screen.
So on callout press - navigate to next screen then
on next screen - on screen open - set label to app variables long/lat - return name text?
Actually I have these variables set on the search screen so should just be able to set label to app variable nickname text. I’ll try see what happens