Related Items repeater on dynamic page

Hi I am having the same problem. I am confused with the sample codes above as they are all named “category”.

Basically I want to achieve the same thing, a related workshops repeater in a dynamic page.

I have
One data collection named “Workshops”
My on-page dataset is named “#dynamicDataset
My matching reference field is called “sorting”
And I need an additional function where the “repeater” will be hidden if theres no other related items.

Can anyone help me with the code? Thank you in advance.

This is my current code which is not working


import wixData from 'wix-data';

$w("#dynamicDataset").onReady( () => {
let sorting = $w("#dynamicDataset").getCurrentItem().sorting; 
       wixData.query("Workshops")
    .include("sorting", "Workshops")
        .eq("available", true)
       .eq("sorting", sorting)
        .limit(8)
        .find()
        .then((results) => {
            $w("#repeater").data = results.items;
        });
});