Hi, I have been working on a project where I need to filter the products based on startDate and endDate provided by the customers.
For this reason, I create a separate database where I store the productId, the date from which it will not be available and the date till which it will not be available.
I have been trying to find the ids of the products in Stores/inventoryItems based on the Ids I get from the database I just created.
wixData.query( “DatesUnavailable” )
.find()
.then((results) =>{
let items = [];
for ( let i = 0 ; i<results.items.length;i++)
{
if ((results.items[i].startUnDate < startDate && results.items[i].endUnDate > endDate)
|| (results.items[i].startUnDate === startDate && results.items[i].endUnDate === endDate))
{
console.log(results.items[i]);
wixData.query( “Stores/InventoryItems” )
.eq( “externalId” , results.items[i].title)
.find()
.then((results1) =>{
console.log( “**********” , results1);
});
}
}
Somehow, I am getting the following error when I run the code above.
Unknown error. Request ID: 1611389473.90638777473458611925. Message: Cannot read property ‘operator’ of null.
Could someone help me with this problem, please?