I have two databases in my website: A “Location” collection and a “Activities” collection. The Location collection contains overall information for guides (for example the name of the guide and the regions it´s about, just Text information ). The Activities collection contains information about certain locations with texts and images.
Each item within the Activities collection “belongs” to an item within the Location collection, so i thought about working with the queryReferenced() function. But there are some questions:
-
The repeater i want to use to display the items from the Activities collection is within a Dynamic Page. That Dynamic Page is connected to the “Locations” dataset. So i need the repeater to change for each item from that collection respectively.
-
I tried to work with the example code from https://www.wix.com/corvid/reference/wix-data.html#queryReferenced .
The description says: This example finds the item in the Movies collection with the ID 00001 . It gets all of the items referenced in the Actors field of that item and then stores the first actor in a variable.
The code:
wixData.queryReferenced("movies", "00001", "actors") .then( (results) => { if(results.items.length > 0)
{let firstItem = results.items[0];}
else {//handle case where no matching items found } } )
.catch( (err) => { let errorMsg = err;});
The second reference in the first row (“00001”) is referring to a specfic item from the Movies collection. Is it possible to write something like currentItem? Because i want to use the code within the Dynamic page.
- Is there any reference to the other collection within that code? How would i refer to my Activities collection?
Greetings, Dawda