Hello everyone,
I’m creating a website for real estate agency using database and I want to put google map on a dynamic page. I have a database with houses containing latitude and longitude:
and a google map on each dynamic page into which I want to import data from the database:
I’m using this code:
let myLocation = $w(“#googleMaps1”).location;
let txtGoogleMaps1 = $w(‘#dataset1’).getCurrentItem().Title;
let txtGoogleMaps1Lat = $w(‘#dataset1’).getCurrentItem().latitude;
let txtGoogleMaps1Long = $w(‘#dataset1’).getCurrentItem().longitude;
$w("#googleMaps1").location = {
“longitude”: txtGoogleMaps1Long,
“latitude”: txtGoogleMaps1Lat,
“description”: txtGoogleMaps1 }
It doesn’t work though and I’m still confused with the code so I have no idea why. Would anyone tell me, what exactly does the code mean and how to fix it? (e. g. why is there “txt” in txtGooleMapsName? getCurrentItem() should pick the value from the right row of the database defined by the current dynamic page or title? and should there be some value between the brackets? Is the word longitude from getCurrentItem().longitude; actually picking data from longitude column in the database? And isn’t it all kind of cycled, when last three rows of the code refer to the previous three rows of the code?)
I’m sorry for a complicated query, but if I could fix it somehow, it would be awesome and if I would even understand it, it would be even better!
Thank you very much for any advice!
Dasha