Hello brains trust,
Can someone advise if it's possible to add details and trigger record retrieval from retool db when clicking on waypoints mapped in the mapbox component? The functionality is quite limited and my partner says my app is stupid
Hello brains trust,
Can someone advise if it's possible to add details and trigger record retrieval from retool db when clicking on waypoints mapped in the mapbox component? The functionality is quite limited and my partner says my app is stupid
@Augustine_Whitehouse,
Yes, you can add details and trigger record retrieval from retool db when clicking on the waypoints in your mapbox component. First, have you mapped your waypoints from your retoolDB to the mapboxMap component along with your point ids?
If so, you can then add a resource query to your retoolDB that runs "on point select". This query will reference the {{name_of_mapboxMap_component.selectedPoint}} property, which will include the point id in your database.
Let me know if you need help with it. (don't listen to your partner!)
Thank you - will give this a go and let you know how it goes!
Hey @Augustine_Whitehouse, just checking in to see how it's going for you.
Thanks for checking in - Have been very busy lately; working on it now - will revert.
I only have long lat values stored in the db, how do I get the point ids?
The point id I am referring to is the id assigned to your item in your database. So each item in your db has at least three fields: id, long and lat.
You can set up a query called "getWaypoints" like this:
const waypoints = queryWaypointsDB.data; // where queryWaypointsDB is the resource query where you select * from your table)
let final = [];
for (let i = 0; i<waypoints.id.length; i++){
let waypointObject = {id:waypoints.id[i], longitude:waypoints.longitude[i], latitude:waypoints.latitude[i]}
final.push(waypointObject)
}
return final;
then use this query as the source for your component in the Points field {{getWaypoints.data}}
Now, when you click on one of the red dots, you can obtain the data for it from your DB:
I hope this helps!
Thanks so much - that helps a lot! One thing I forgot to mention is that Iām using the mobile app.. Will this work on this platform as well?
Sure thing @Augustine_Whitehouse! (and, yes, this will work on your mobile app too)