I need a help regarding dataset filter. I have database with 100 record. Using wixdate queery i ahve found the records and append in array.
Now i want to pass that array elements to dataset filter. SO after that i show all record in repeater after that filter/
filteredItems =[“apple”,“car”,“etc”]
for ( var j= 0 ;j<3;j++)
{
$w( "#dataset1" ).setFilter( wixData.filter()
.eq( “title” , filteredItems[j])
);
}
after running that code it only show last index filter how it show all
Since you are filtering by title I am assuming you are returning one item from the database for every element of the array. If that is the case you can do something like this
let filteredItems = ["title1", title2", ...]
let returnedItems = []
for(let i = 0; i < filteredItems.length; i++) {
let item = $w("#dataset1").filter().eq("title", filteredItems[i]))
returnedItems.push(item)
}
Then you can just filter through the new array and display the results or if you are working with a repeater you can directly set the repeater items to the new array value.