Hi.
I have two collections.
-
astrouserobjects - this contains objects (Astro objects) that have been seen by astronomers who are users of my website. Each object has a unique id (a GUID) that is stored in the collection’s hidden _Id field.
-
astrouserobjectsimages - this contains images and image details that these astronomers (users on my site) have seen for the Astro Objects in the astrouserobjects collection. A record for each image seen. In this collection, there is a astroUserObjectId field. This field is a text field and stores the id, a GUID, of the astronomer object that is stored in the _Id field in the astrouserobjects collection.
Here’s an example of a user object id:
41aa2a4c-d4a0-4d3e-a415-e1208123c409
I have a dynamic item page for each user’s Astro Object. On this page, I have a Repeater that is populated by a dataset, datset4, of the astrouserobjectsimages collection. This displays all the images the user has taken for this specific Astro object.
On this page in code, I retrieve the id of the user’s Astro object from the astrouserobjects collection via currentObject._id and store it in a variable, UserObjectId (a String). I can see in the Console that the id of the user’s Astro object is retrieved and stored in my variable. Part of the code looks like this:
$w('#dynamicDataset').onReady(() => {
currentObject = $w('#dynamicDataset').getCurrentItem()
//userobject id
UserObjectId = currentObject._id;
On the same page, I have created a function to query the astrouserobjectsimages collection dataset by the variable, UserObjectId, using the .eq function. This is part of the code:
$w("#dataset4").setFilter(wixData.filter()
.eq("astroUserObjectId",UserObjectId)
However, this does not return any records and therefore no records are displayed in the Repeater. Strangely, if I hardcode the user’s object id in the query like this:
.eq("astroUserObjectId","41aa2a4c-d4a0-4d3e-a415-e1208123c409")
the records are returned and displayed in the Repeater.
Any idea on how to resolve this?
Many thanks
Mark