Show only active users on a repeater

Hey all,
I wish to show a repeater contains only users who marked their profiles as ACTIVE.
Here’s the code I’m currently using, which works (shows ALL profiles, randomly) but ignores the ‘inActive’ filed (whith is a true\false field).


wixData.query(“Profiles”)
.find()
.then((result) => {
const shuffledArray = shuffleArray(result.items);
//add the shuffled array data to then repeaters
$w(‘#repeater2’).data = shuffledArray;
})
. catch ((err) => {
let errorMsg = err;
});
});

//random array index
function getRandomIndex(min, max) {
return Math.round(Math.random() * (max - min) + min);
}

//shuffle array data
function shuffleArray(dataArray){

for(let i = dataArray.length - 1; i > 0; i–){
let index = getRandomIndex(0, i);
const temp = dataArray[i];
dataArray[i] = dataArray[index];
dataArray[index] = temp;
}

return dataArray;
}

Why not just use setFilter to set the profile repeater to show only profiles with only active shown?
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#setFilter

Thank you. The problem is while there is a filter (show only results with isActive=true), I need to random the results and it seems like the code ignores the filter

Okay - found the code needed:

$w(“#dataset1”).setFilter(wixData.filter()
.eq(“isActive”, true )
);

Now it works.