I have a Event collection that references a Venue collection. I’m pulling back a single row of data through the join. This data populates a dynamic page. All the fields on the page work as expected.
But, I have a small amount of javascript used to create a google map and this is where unexpected things happen.
To retrieve data from the Event collection I merely use:
let currentItem = $w(“#dynamicDataset”).getCurrentItem();
console.log( currentItem.title);
console.log( currentItem.date);
/* etc */
But for the fields coming via the join with Venue, the data are deeper nested:
…
let venue = currentItem.venue._item;
console.log( venue.latitude);
console.log( venue.longitude);
/* etc */
I was expecting all the fields to be at the same level. The join should be transparent at the javascript level, as though I’d pulled it back from a single collection. And to through “_item” is ugly.
What am I doing wrong? I looked for code exampled here but could find nothing.
Thanks
Stephen