getTotalPageCount() returns 0 for a Dataset inspite of the dataset having entries.

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"); 
}

Hello,

Start from debugging your code by following the instructions from the article below:

Corvid: Testing and Debugging Your Code

If you try the following code and the result still will be zero (even though there are several items in your database collection), I’d recommend to contact Wix Customer Care and provide all the details regarding the issue so they can take a look at it.

let pageCount = $w("#myDataset").getTotalPageCount();

Hi Anastasiia thank you very much for replying to my query. I’ll debug my code according to the article and see if that works. Thanks Again.