I have written a code to filter my dataset which filters it based on a column ‘orderId’ in the dataset. Since I was getting an undefined result after doing the filter I tried to check the content of the dataset using getTotalPageCount() and it returned 0 inspite of having 5 records. Could anyone help me understand what is the issue?
function search () {
let received = wixWindow.lightbox.getContext();
console.log("Search function called - " +$w("#thisDataset").getItems()); // returned [object Promise]
console.log("Search function called - " +$w("#thisDataset").getTotalPageCount()); //returned 0
$w("#thisDataset").setFilter(wixData.filter()
.contains("Order_ID", received.pageSend1))
.then(()=>{
let results = $w("#thisDataset").getItems();
console.log("result - " + results); // returned [object Promise]
console.log("Dataset is now filtered by", received.pageSend1);
})
.catch((error) => {
let errorMsg = error.message;
let code = error.code;
console.log("Catch - " + errorMsg);
});
console.log("Search function exiting");
}